Vous êtes sur la page 1sur 24

Building Raspberry Pi

Controllers with Python


Class 2: Introduction to the
Python Programming Language

July 7, 2015
Don Wilcher

Presented by:

Introduction to the Python


Programming Language
Day 2 Agenda:

Concepts of the Python Programming Language


Review of the Python IDLE and shell
sudo Python IDLE and shell
Coding with Python using interpretive
programming
Building a simple calculator

Presented by:

Introduction to the Python


Programming Language
Learning Objectives:
Learn about the Python Programming
Language
Learn about Python IDLE and shell
Learn about sudo Python IDLE and shell
Learn how to build simple Python
calculators

Presented by:

Concepts of the Python


Programming Language
Python is:
An object oriented language
An interpretive programming
language
An easy to learn programming
language
A rapid prototyping tool for object
models and algorithms
A creative programming languagePresented
for by:
creating
4 games and graphics

Concepts of the Python


Programming Language
Who created Python?
Guido Van Rossum (A Dutch Computer
Programming)
He created the language in 1986
He worked for Google from 2005 -2012
Started working for Dropbox in 2013

Presented by:

Python Question 1:

What type of programming


language is Python?

Presented by:

Concepts of the Python


Programming Language
Why did Guido Van Rossum created
Python?
He was looking for a hobby
programming language to keep him
occupied during the Christmas season.
He wanted code that is as
understandable as plain English
To teach programming in elementary
and secondary schools (DARPA proposal:
Computer Programming for Everyone
Presented by:

Python Question 2:

Why did Guido Van Rossum created


the Python programming language?

Presented by:

Review of Python IDLE and


Shell
How to gain
access to
the Python
Shell !

Presented by:

Review of Python IDLE and


Shell

The Python Shell


allows you to test
algorithms and
code interactively!

Presented by:

10

Python Question 3
IDLE is the abbreviation for what
Python development tool?

Presented by:

11

Review of Python IDLE and


Shell
Help is just 2-clicks
away!

Presented by:

12

Review of Python IDLE and


Shell
Online Help: Python Documentation

Presented by:

13

vs
Whats different between the two versions?

Source:
http://learntocodewith.me/programming/python/python-2-vs-python-3/
Presented by:

14

Python Question 4
What shell tool allows access to
the Python Documentation?

Presented by:

15

Gaining access to sudo


python

Presented by:

16

Gaining access to sudo


python

Presented by:

17

Interpretive Programming
Example

Presented by:

18

Interpretive Programming:
Lets Build a Calculator
Lets build a Python Application (Calculator)
using interpretive programming to find the
voltage drop across a dc motor!
Problem:
A dc motors resistance is equal to 4.
The current that flows through the resistor
is 500mA. What is the voltage drop across
the dc motor?
Equation: Vmotor = Rmotor x Imotor
Presented by:

19

Interpretive Programming:
Lets Build a Calculator
Heres the DC Motor
Circuit for the Python
Calculator Analysis!

Presented by:

20

Interpretive Programming:
Lets Build a Calculator
Solution:
Rmotor = 4
Imotor = 250mA
Equation: Vmotor = Imotor x Rmotor
Vmotor = 250mA x4
Vmotor = 1V

Presented by:

21

Interpretive Programming:
Lets Build a Calculator
Solution:

Presented by:

22

Interpretive Programming:
Lets Build a Calculator
The circuit analysis
result value is less than
the Python Calculator
answer because of model
component variations!

Presented by:

23

Python Question 5:

Why is there a slight difference in Imotor


values between the Python calculation
and the Microcap circuit model?

Presented by:

24

Vous aimerez peut-être aussi