Pi Is For…
Programming
In
Raspberry
Computers Don’t
Do Anything
Without
Instructions
Programming, or
Coding, is how we
tell computers what
to do using
instructions that
the computer
understands.
What Is A Computer Interface?
Jacquard Loom Interface - 1801
Switch Computer Interface - ENIAC 1945
1950’s - 1960’s Business
No Command Line Interface
1990’s Personal
Graphical User Interface (GUI)
Command Line Computer Interface
1970’s Personal
Command Line Interface Only
(Sometimes called Shell Or Console)
Python Uses A Command Line Interface?
ARM Cortex-A53 CPU
How Does Programming Work?
Hardware Specific, Very Fast But
Very Difficult For Human
Comprehension. This Is The Language
That The Computer Speaks.
ARM Cortex-A53 CPU
How Does Programming Work?
How Does Programming Work?
ARM Cortex-A53 CPU
Hardware Specific, Very Fast And
Somewhat Comprehendible For People.
ARM Cortex-A53 CPU
How Does Programming Work?
ARM Cortex-A53 CPU
How Does Programming Work?
High Level Languages Are Considered
Cross Platform and Comprehendible.
To Maintain Speed They Compile An
Assembly Or Machine Language
Version Of The Code Specifically
For The CPU.
ARM Cortex-A53 CPU
Quality Compilers Can Generate Quicker Code
C Often Used In Graphics and Operating Systems
How Does Programming Work?
ARM Cortex-A53 CPU
Quality Compilers Can Generate Quicker Code
C Often Used In Graphics and Operating Systems
How Does Programming Work?
ARM Cortex-A53 CPU
PYTHON BASIC
Dynamic high-level general-purpose
scripting languages (such as Python
and PERL) execute programs in real
time using pre-compiled API’s or
machine code. Their advantage is
that programs can be be constructed
from pre built blocks and combined
into complex programs.
PERL
Software Intermediary
How Does Programming Work?
How Does Programming Work?
ARM Cortex-A53 CPU - Linux
PYTHON CODE
Python Virtual Machine
Bytecode
How Does Programming Work?
PYTHON CODE
ARM Cortex-A53 CPU - Linux
Python Virtual Machine
AMD Athlon™ X4 CPU - Windows
Python Virtual Machine
Intel® Core™ i7 CPU - MAC OSX
Python Virtual Machine
Hello world! In Machine Code
Why Python?
Why Python?
Hello world! In Assembly Language
Why Python?
Hello world! In BASIC, C and Python
Why Python?
● Python Is A General Purpose Language
○ Many computer devices
○ Libraries for most applications.
● Large Standard Code Library
○ Standard Library runs on Raspberry Pi or CRAY Supercomputer.
● Can Be Compiled To Machine Language
○ Cython compiles Python code To C.
● Can Call C Code
○ Python ctypes
● Clean code
○ Employs indentation
○ No {..code in here..} or <div>..or stuff in here..<div>
● Libraries, Libraries, Libraries
○ The secret power of Python
○ 67,000 libraries (Jan 1, 2016)
Getting Started On Raspberry Pi
● https://www.raspberrypi.org/documentation/usage/python/
○ RUNNING PYTHON ON A RASPBERRY PI
○ INDENTATION
○ VARIABLES
○ COMMENTS
○ LISTS
○ ITERATION and RANGE
○ CREATING/SAVING PYTHON FILES
○ EXECUTING PYTHON FILES
Python Interactive Mode
Python Shell
Command Line Interface
Python Prompt
>>>
Getting Started On Raspberry Pi
Python Interactive Mode
Getting Started On Raspberry Pi
Getting Started On Raspberry Pi
Python Interactive Mode
Getting Started On Raspberry Pi
Python Run Module
Getting Started On Raspberry Pi
Python Run Module
Getting Started On Raspberry Pi
Python Run Module
Getting Started On Raspberry Pi
Python Run Module
CODE
https://trinket.io
Programming In Python - Overview
CODE
RESULT
(CONSOLE OUTPUT)
https://trinket.io
Programming In Python - Overview
https://trinket.io/python/81bea2e14c
Python Sequence Code
https://trinket.io/python/81bea2e14c
Python Sequence Code
https://trinket.io/python/883c20b4a3
Python Functions Code
https://trinket.io/python/883c20b4a3
Python Functions Code
https://trinket.io/python/883c20b4a3
Python Functions Code
https://trinket.io/python/81bea2e14c
Python Functions Code
https://trinket.io/python/883c20b4a3
Python Functions Code
• Python runs as a minimum with always available “built-in
libraries”.
• Libraries provide the code functionality
Python Built-In Libraries
https://trinket.io/python/df57cd9d6f
Python Import Standard Libraries
https://trinket.io/python/df57cd9d6f
Python Import Standard Libraries
Python Object Oriented Code
OBJECT
Python Object Oriented Code
OBJECT
PROPERTIES
Python Object Oriented Code
Python Object Oriented Code
https://trinket.io/python/a9a6112ca5
Python Object Oriented Code
https://trinket.io/python/d4e0f1f07d
Python Object Oriented Code
Python “Clean” Code
Python “Clean” Code
Indentation
and levels
used as
separators in
code. No curly
braces or
containers.
Python “Clean” Code
Minimal use of
colons, semi-
colons, etc.
External Libraries - Wikipedia
The Beatles Wikipedia Page
External Libraries - Wikipedia
Packages Located In The Python Package Index
(PyPI)
External Libraries - Wikipedia
Use Raspberry Pi Terminal To Install External
Libraries Using PIP
External Libraries - Wikipedia
“sudo pip install wikipedia” In Terminal Installs
The Python Wikipedia Library On Your Raspberry Pi
External Libraries - Wikipedia
Estimated 67,000 Libraries (Jan 1, 2016)
Review
Review
PYTHON CODE
ARM Cortex-A53 CPU - Linux
Python Virtual Machine
AMD Athlon™ X4 CPU - Windows
Python Virtual Machine
Intel® Core™ i7 CPU - MAC OSX
Python Virtual Machine
Review
Review
Review
Review
Review
Review
Review
Review
Review
Review
Contact

Pi Is For Python