SlideShare a Scribd company logo
Agenda of LO CS.1.09 W5
1- Warm up Revision 10 min
2- ppt teacher demonstrate about Python 15m
3- Video about Python 5min
4- Practical work Students divided in pairs and use
Anaconda : Spyder or on line Python platform to
create very simple program using python
-3.8.1 7
- Questions and answers as pretest about Python 5 m
8-Refelection 5 min
9- Home work 5 min
Python
Eng. & Educator Osama
Ghandour
LO CS.1.09 W5 :
Students can design
programs involving the
logical operators and
conditional statements.
Lesson plan
Python
Eng. & Educator Osama
Ghandour
Warm Up
Listen to this video
Offline
On line
Python
Eng. & Educator Osama
Ghandour
Warm up 5 min
1-Arithmetic Expressions .
2-Running and debagging programs.
3- if Statement , if else , nested if .
4- loops = “repetitions ” = donkey
work =machine work , nested loops
Eng. & Educator Osama
Ghandour
Python
Anaconda : Spyder or an on line Python platform
Inputs : 1- though console 2- input message 3- sensors 2- Dataset
Python – Cheat sheets
You can install python-2.7.17 or python-3.8.1
Write Program / Code
Eng. & Educator Osama
Ghandour
Python
Installing Anaconda
Eng. & Educator Osama
Ghandour
Anaconda > Use Spyder
Eng. & Educator Osama
Ghandour
Python
Coding window – Ipython console - Variable explorer
Spyder
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Compiling and interpreting
in Python.
Listen to this video
Offline On line
Offline On line
Eng. & Educator Osama
Ghandour
Python
Eng. & Educator Osama
Ghandour
Donkey work =
repetition = iteration –
loops – inside it there
are conditions
Eng. & Educator Osama
Ghandour
Further programming
• Lab exercises
– Let's go downstairs to the basement computer
labs!
• - learn prcticaly
• What next?
– Lists , Dictionaries , Algorithms etc.
Eng. & Educator Osama
Ghandour
Essential Questions
• Essential Questions: learn
practically by designing a program
which include 1- the logical
operators and give some
examples. 2- Comparing between
if & switch statements and give
some examples. 3- Write the
general syntax of the conditional
statements (if & switch). Eng. & Educator Osama
Ghandour
Evidence of Learning:
Create a project with a
programming language
“Python” using Variables,
Constants Arithmetic, and
Assignment operators.
Eng. & Educator Osama
Ghandour
15
if
 If statement: Executes a group of
statements only if a certain condition is
true. Otherwise, the statements are
skipped.
 Syntax:
if condition:
statements
 Example:
gpa = 3.4
if gpa > 2.0:
print "Your application is accepted."
Eng. & Educator Osama
Ghandour
16
if/else
 if/else statement: Executes one block of statements if a certain
condition is True, and a second block of statements if it is False.
 Syntax:
if condition:
statements
else:
statements
 Example:
gpa = 1.4
if gpa > 2.0:
print "Welcome to Mars University!"
else:
print "Your application is denied."
 Multiple conditions can be chained with elif ("else if"):
if condition:
statements
elif condition:
statements
else:
statements Eng. & Educator Osama
Ghandour
17
while
 while loop: Executes a group of statements as long as a condition
is True.
 good for indefinite loops (repeat an unknown number of times)
 Syntax:
while condition:
statements
 Example:
number = 1
while number < 200:
print number,
number = number * 2
 Output:
1 2 4 8 16 32 64 128
Eng. & Educator Osama
Ghandour
18
Logic
 Many logical expressions use relational operators:
 Logical expressions can be combined with logical operators:
 Exercise: Write code to display and count the factors of a number.
Operator Example Result
and 9 != 6 and 2 < 3 True
or 2 == 3 or -1 < 5 True
not not 7 > 0 False
Operator Meaning Example Result
== equals 1 + 1 == 2 True
!= does not equal 3.2 != 2.5 True
< less than 10 < 5 False
> greater than 10 > 5 True
<= less than or equal to 126 <= 100 False
>= greater than or equal to 5.0 >= 5.0 True
home work
Eng. & Educator Osama Ghandour
Exercise :
19
• Write a program to prompt for a score between 0.0
and 1.0.
If the score is out of range, print an error message.
If the score is between 0.0 and 1.0,
print a grade using the following table:
• Score Grade • >= 0.9 A
• >= 0.8 B
• >= 0.7 C
• >= 0.6 D
• < 0.6 F
• ~~~ • Enter score: 0.95 A ~~
• Enter score: perfect • Bad score
• Enter score: 10.0 • Bad score
• Enter score: 0.75 • C • Enter score: 0.5 • F
Dictionaries
 Dictionaries
• Dictionaries: curly brackets { }
• What is dictionary?
• Refer value through key; “associative arrays”
• Like an array indexed by a string
• An unordered set of key: value pairs
• Values of any type; keys of almost any type
• {"name":"Guido", "age":43, ("hello","world"):1,
42:"yes", "flag": ["red","white","blue"]}
• d = { "foo" : 1, "bar" : 2 } print d["bar"] # 2
some_dict = {} some_dict["foo"] = "yow!" print
some_dict.keys() # ["foo"]
20
Eng. & Educator Osama
Ghandour
21
Eng. & Educator Osama
Ghandour
22
Eng. & Educator Osama
Ghandour
functions
 Functions in Python
 Defining functions.
 Return values.
 Local variables.
 Built-in functions.
 Functions of functions.
 Passing lists, dictionaries, and
keywords to functions.
23
Eng. & Educator Osama
Ghandour
functions
24
Why functions?
• It may not be clear why it is worth the trouble to divide a
program into functions. • There are several reasons: •
Creating a new function gives you an opportunity to name a
group of statements, which makes your program easier to
read, understand, and debug. • Functions can make a
program smaller by eliminating repetitive code. Later, if you
make a change, you only have to make it in one place. •
Dividing a long program into functions allows you to debug
the parts one at a time and then assemble them into a
working whole. Well-designed functions are often useful for
many programs. Once you write and debug one, you can
reuse it
Eng. & Educator Osama
Ghandour
functions
 Define a Function: def
 Define them in the file above the point
they're used Body of the function
should be indented consistently (4
spaces is typical in Python) Example:
square.py def square(n): return n*n
 print "The square of 3 is ", print
square(3)
 Output: The square of 3 is 9
25
Eng. & Educator Osama
Ghandour
functions
 The def statement
 The def statement is executed (that's
why functions have to be defined
before they're used) def creates an
object and assigns a name to
reference it; the function could be
assigned another name, function
names can be stored in a list, etc.
Can put a def statement inside an if
statement, etc!
26
Eng. & Educator Osama
Ghandour
functions
27
Eng. & Educator Osama
Ghandour
functions
Functions, Procedures
def name(arg1, arg2, ...):
"""documentation"""#
optional doc string
statements
return # from procedure
return expression # from
function
28
Eng. & Educator Osama
Ghandour
functions
 More about functions
 • Arguments are optional. Multiple
arguments are separated by commas “ , ”.
• If there's no return statement, then
“None” is returned. Return values can be
simple types or tuples. Return values may
be ignored by the caller. • Functions are
“typeless.” Can call with arguments of any
type, so long as the operations in the
function can be applied to the arguments.
This is considered a good thing in Python
29
Eng. & Educator Osama
Ghandour
Connection to math
Eng. & Educator Osama
Ghandour
Create, interpret and analyze quadratic functions that model
real-world situations. W1-4
Key Concepts:
o 1. Quadratic Function
o 2. First and second differences
o 3. Completing the square
o 4. Complex numbers
o 5. Parabola
o 6. Focus
o 7. Argand diagram
o 8. related roots
Mechanics
Eng. & Educator Osama
Ghandour
Learning Outcome: Use position, displacement, average and
instantaneous velocity, average and instantaneous acceleration
to describe 1-dimensional motion of an object. W1-3
Key Concepts:
o 1. Position /Time graphs
o 2. velocity/Time graphs
o 3. Acceleration /Time graphs
o 4. Relative velocity.
o 5. Instantaneous velocity
o 6. Average velocity
o 7. Reference Frames
Mechanics
Eng. & Educator Osama
Ghandour
Week 04 - Week 08
Learning Outcome: Use kinematic equations
to understand and predict 1-dimensional motion
of objects under constant acceleration,including
vertical (free-fall) motion under gravity.
Key Concepts:
 1. Area under a curve
 2. Kinematic equations for 1-D motion with
constant acceleration
 3. Free-fall motion
Physics
• . Fluids w1-3
• 2. Pressure
• 3. Manometer
• 4. Pressure gauge
• 5. Units of pressure
• 6. Effect of atmospheric pressure on boiling point of
water
• 7. Change in atmospheric pressure with altitude
• 8. Pressure difference and force
• 9. Archimedes Principle
Eng. & Educator Osama
Ghandour
Check your email to Solve the
Online auto answered
quiz 15 min after
school the quiz will be
closed in 10:00pm
after
tomorrow
Eng. & Educator Osama
Ghandour
Python
Repetition (loops) in
Python.
Listen to this video
Offline On line
Offline On line
Eng. & Educator Osama
Ghandour
Python
Selection (if/else) in
Python
Listen to this video
Offline On line
Offline On line
Eng. & Educator Osama
Ghandour
Python
Read /write to Arduino pins
Eng. & Educator Osama
Ghandour
Now you can plug the usb cable
Eng. & Educator Osama
Ghandour
Run Arduino UNO with PyFirmata
library
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Communicate with standard Firmata
as downloading it to Arduino
Eng. & Educator Osama
Ghandour
Now you can un plug
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Arduino Temperature control
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Eng. & Educator Osama
Ghandour
Evidence of Learning &home work
• Start a task by
1- Create a project using logical
operators and conditional
statements. 2- Create a function
with parameters and call it.
• Complete the task as home work
Eng. & Educator Osama
Ghandour
Summary
1-Using logical operators and give
some examples.
2- using & Comparing between if
&switch statements and give some
examples.
3- Write the general syntax of the
conditional statements (if& switch).
Eng. & Educator Osama
Ghandour
Python
Prepare for next week
According to student’s law
Gn=Wn % Ng
CS.1.07 - 1- Gain knowledge
and understanding the
meaning of computer
language? 2- Draw conclusions
about concepts
Eng. & Educator Osama
Ghandour
Python
Reflection
• Mention 2 things you learned today
• What is your goal to accomplish in
next week end in programming using
Python?
Eng. and Educator Osama
Ghandour
Python
Home work (s. proj.) 1
you studied in physics about
electric power and in your capstone about
saving wasted energy so design a flowchart
for Arduino control circuit to save the
consumed energy in electric power circuit .
Note : an ideal electric system has power
factor PF=0.999 and very low reactive
power. using logical operators and
conditional statements beside a function
with parameters , calling it to complete a
program .
Eng. and Educator Osama
Ghandour
Python
Rubaric
Blue
student differentiate between / use logical operators
and conditional statements with examples.
Green
student differentiate between / use logical operators
and conditional statements .
Yello
w
student mention features / use one of logical operators
or conditional statements .
Read
student don`t have any idea about logical operators and
conditional statements .
Eng. and Educator Osama
Ghandour
Python
Resources
• https://www.youtube.com/watch?v=Rtww83GH
0BU
• Other materials:
• https://www.sololearn.com
• https://www.w3schools.com
• www.python.org
Eng. and Educator Osama
Ghandour
Python
Textbook and Resource
Materials:
https://www.w3schools.com/python/pyth
on_dictionaries.asp
https://www.w3schools.com/python/pyth
on_functions.asp
.
Eng. & Educator Osama
Ghandour
Resources
• https://www.youtube.com/user/osmgg2
Other materials:
• https://www.sololearn.com
• https://www.w3schools.com
• www.python.org
• “Learning Python,” 2nd edition, Mark Lutz
and David Ascher (O'Reilly, Sebastopol, CA,
2004) (Thorough. Hard to get into as a quick
read)
Eng. & Educator Osama
Ghandour
Python
Learn and practice through on line web sites
https://www.thewebevolved.com
https://www.123test.com/
https://www.wscubetech.com/
https://www.w3schools.com/
https://www.guru99.com
https://codescracker.com/exam/review.php
https://www.arealme.com/left-right-brain/en/
https://www.proprofs.com/
https://www.geeksforgeeks.org/
https://www.tutorialspoint.com
https://www.sololearn.com
http://www.littlewebhut.com/
Eng. & Educator Osama
Ghandour
Python
If you do not feel happy, smile
and pretend to be happy.
• Smiling produces seratonin
which is a neurotransmitter
linked with feelings of
happiness
Thanks
Eng. & Educator Osama
Ghandour
Python
https://twitter.com/osamageris
https://www.linkedin.com/in/osamaghandour/
https://www.youtube.com/user/osmgg2
https://www.facebook.com/osama.g.geris
Eng. & Educator Osama
Ghandour
Python

More Related Content

What's hot

Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandourPython week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Python basics
Python basicsPython basics
Python basics
TIB Academy
 
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Edureka!
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
Srinivas Narasegouda
 
Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
Akhil Kaushik
 
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Universitat Politècnica de Catalunya
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
CloudxLab
 
2019 session 6 develop programs to solve a variety of problems in math , phys...
2019 session 6 develop programs to solve a variety of problems in math , phys...2019 session 6 develop programs to solve a variety of problems in math , phys...
2019 session 6 develop programs to solve a variety of problems in math , phys...
Osama Ghandour Geris
 
Text Classification Powered by Apache Mahout and Lucene
Text Classification Powered by Apache Mahout and LuceneText Classification Powered by Apache Mahout and Lucene
Text Classification Powered by Apache Mahout and Lucene
lucenerevolution
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Maulik Borsaniya
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
Ni
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
Praveen M Jigajinni
 
Python Functions 1
Python Functions 1Python Functions 1
Python Functions 1
gsdhindsa
 
Attention mechanisms with tensorflow
Attention mechanisms with tensorflowAttention mechanisms with tensorflow
Attention mechanisms with tensorflow
Keon Kim
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of Python
Information Technology
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
Siddique Ibrahim
 
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text AnalysisRecurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysis
odsc
 

What's hot (19)

Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandourPython week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
 
Python basics
Python basicsPython basics
Python basics
 
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)Chapter 0 Python Overview (Python Programming Lecture)
Chapter 0 Python Overview (Python Programming Lecture)
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
 
2019 session 6 develop programs to solve a variety of problems in math , phys...
2019 session 6 develop programs to solve a variety of problems in math , phys...2019 session 6 develop programs to solve a variety of problems in math , phys...
2019 session 6 develop programs to solve a variety of problems in math , phys...
 
Text Classification Powered by Apache Mahout and Lucene
Text Classification Powered by Apache Mahout and LuceneText Classification Powered by Apache Mahout and Lucene
Text Classification Powered by Apache Mahout and Lucene
 
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYAChapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
Chapter 1 - INTRODUCTION TO PYTHON -MAULIK BORSANIYA
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Python Functions 1
Python Functions 1Python Functions 1
Python Functions 1
 
Attention mechanisms with tensorflow
Attention mechanisms with tensorflowAttention mechanisms with tensorflow
Attention mechanisms with tensorflow
 
About Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of PythonAbout Python Programming Language | Benefit of Python
About Python Programming Language | Benefit of Python
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
 
Py tut-handout
Py tut-handoutPy tut-handout
Py tut-handout
 
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text AnalysisRecurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysis
 

Similar to Python week 5 2019 2020 for g10 by eng.osama ghandour

Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandourPython cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
Hamad Odhabi
 
Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)
Ahmed Gad
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
lailoesakhan
 
Intro to Python for Non-Programmers
Intro to Python for Non-ProgrammersIntro to Python for Non-Programmers
Intro to Python for Non-Programmers
Ahmad Alhour
 
ForLoops.pptx
ForLoops.pptxForLoops.pptx
ForLoops.pptx
RabiyaZhexembayeva
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
yannick grenzinger
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
Ruth Marvin
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your teamPawel Lipinski
 
Module 1 - Programming Fundamentals.pptx
Module 1 - Programming Fundamentals.pptxModule 1 - Programming Fundamentals.pptx
Module 1 - Programming Fundamentals.pptx
GaneshRaghu4
 
Python Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowPython Programming - III. Controlling the Flow
Python Programming - III. Controlling the Flow
Ranel Padon
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
Ranel Padon
 
MIT6_0001F16_Lec1.pdf
MIT6_0001F16_Lec1.pdfMIT6_0001F16_Lec1.pdf
MIT6_0001F16_Lec1.pdf
ssuser125b6b
 
Java publish
Java publishJava publish
Java publish
Priya Kumaraswami
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
Syed Farjad Zia Zaidi
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
DeepikaV81
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and import
iamluqman0403
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
ssuser586772
 
Application development with Python - Desktop application
Application development with Python - Desktop applicationApplication development with Python - Desktop application
Application development with Python - Desktop application
Bao Long Nguyen Dang
 

Similar to Python week 5 2019 2020 for g10 by eng.osama ghandour (20)

Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandourPython cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
 
Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
 
Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
 
Intro to Python for Non-Programmers
Intro to Python for Non-ProgrammersIntro to Python for Non-Programmers
Intro to Python for Non-Programmers
 
ForLoops.pptx
ForLoops.pptxForLoops.pptx
ForLoops.pptx
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your team
 
Module 1 - Programming Fundamentals.pptx
Module 1 - Programming Fundamentals.pptxModule 1 - Programming Fundamentals.pptx
Module 1 - Programming Fundamentals.pptx
 
Python Programming - III. Controlling the Flow
Python Programming - III. Controlling the FlowPython Programming - III. Controlling the Flow
Python Programming - III. Controlling the Flow
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
 
MIT6_0001F16_Lec1.pdf
MIT6_0001F16_Lec1.pdfMIT6_0001F16_Lec1.pdf
MIT6_0001F16_Lec1.pdf
 
Java publish
Java publishJava publish
Java publish
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Java developer trainee implementation and import
Java developer trainee implementation and importJava developer trainee implementation and import
Java developer trainee implementation and import
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
 
Application development with Python - Desktop application
Application development with Python - Desktop applicationApplication development with Python - Desktop application
Application development with Python - Desktop application
 

More from Osama Ghandour Geris

functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
Osama Ghandour Geris
 
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
Osama Ghandour Geris
 
6 css week12 2020 2021 for g10
6 css week12 2020 2021 for g106 css week12 2020 2021 for g10
6 css week12 2020 2021 for g10
Osama Ghandour Geris
 
Css week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandourCss week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Cooding history
Cooding history Cooding history
Cooding history
Osama Ghandour Geris
 
Computer networks--network
Computer networks--networkComputer networks--network
Computer networks--network
Osama Ghandour Geris
 
How to print a sketch up drawing in 3d
How to print a sketch up drawing  in 3dHow to print a sketch up drawing  in 3d
How to print a sketch up drawing in 3d
Osama Ghandour Geris
 
Google sketch up-tutorial
Google sketch up-tutorialGoogle sketch up-tutorial
Google sketch up-tutorial
Osama Ghandour Geris
 
7 types of presentation styles on line
7 types of presentation styles on line7 types of presentation styles on line
7 types of presentation styles on line
Osama Ghandour Geris
 
Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020
Osama Ghandour Geris
 
Php introduction
Php introductionPhp introduction
Php introduction
Osama Ghandour Geris
 
How to use common app
How to use common appHow to use common app
How to use common app
Osama Ghandour Geris
 
Creating databases using xampp w2
Creating databases using xampp w2Creating databases using xampp w2
Creating databases using xampp w2
Osama Ghandour Geris
 
warm up cool down
warm  up cool down warm  up cool down
warm up cool down
Osama Ghandour Geris
 
Flow charts week 5 2020 2021
Flow charts week 5 2020  2021Flow charts week 5 2020  2021
Flow charts week 5 2020 2021
Osama Ghandour Geris
 
Xamppinstallation edited
Xamppinstallation editedXamppinstallation edited
Xamppinstallation edited
Osama Ghandour Geris
 
Bloom s three pyramids
Bloom s three pyramidsBloom s three pyramids
Bloom s three pyramids
Osama Ghandour Geris
 
The learning experiences ladder
The learning experiences ladderThe learning experiences ladder
The learning experiences ladder
Osama Ghandour Geris
 
2019 numbering systems decimal binary octal hexadecimal
2019 numbering systems decimal   binary octal hexadecimal2019 numbering systems decimal   binary octal hexadecimal
2019 numbering systems decimal binary octal hexadecimal
Osama Ghandour Geris
 
Inquiry ibl project
Inquiry ibl projectInquiry ibl project
Inquiry ibl project
Osama Ghandour Geris
 

More from Osama Ghandour Geris (20)

functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
 
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
 
6 css week12 2020 2021 for g10
6 css week12 2020 2021 for g106 css week12 2020 2021 for g10
6 css week12 2020 2021 for g10
 
Css week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandourCss week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandour
 
Cooding history
Cooding history Cooding history
Cooding history
 
Computer networks--network
Computer networks--networkComputer networks--network
Computer networks--network
 
How to print a sketch up drawing in 3d
How to print a sketch up drawing  in 3dHow to print a sketch up drawing  in 3d
How to print a sketch up drawing in 3d
 
Google sketch up-tutorial
Google sketch up-tutorialGoogle sketch up-tutorial
Google sketch up-tutorial
 
7 types of presentation styles on line
7 types of presentation styles on line7 types of presentation styles on line
7 types of presentation styles on line
 
Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020
 
Php introduction
Php introductionPhp introduction
Php introduction
 
How to use common app
How to use common appHow to use common app
How to use common app
 
Creating databases using xampp w2
Creating databases using xampp w2Creating databases using xampp w2
Creating databases using xampp w2
 
warm up cool down
warm  up cool down warm  up cool down
warm up cool down
 
Flow charts week 5 2020 2021
Flow charts week 5 2020  2021Flow charts week 5 2020  2021
Flow charts week 5 2020 2021
 
Xamppinstallation edited
Xamppinstallation editedXamppinstallation edited
Xamppinstallation edited
 
Bloom s three pyramids
Bloom s three pyramidsBloom s three pyramids
Bloom s three pyramids
 
The learning experiences ladder
The learning experiences ladderThe learning experiences ladder
The learning experiences ladder
 
2019 numbering systems decimal binary octal hexadecimal
2019 numbering systems decimal   binary octal hexadecimal2019 numbering systems decimal   binary octal hexadecimal
2019 numbering systems decimal binary octal hexadecimal
 
Inquiry ibl project
Inquiry ibl projectInquiry ibl project
Inquiry ibl project
 

Recently uploaded

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 

Recently uploaded (20)

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 

Python week 5 2019 2020 for g10 by eng.osama ghandour

  • 1. Agenda of LO CS.1.09 W5 1- Warm up Revision 10 min 2- ppt teacher demonstrate about Python 15m 3- Video about Python 5min 4- Practical work Students divided in pairs and use Anaconda : Spyder or on line Python platform to create very simple program using python -3.8.1 7 - Questions and answers as pretest about Python 5 m 8-Refelection 5 min 9- Home work 5 min Python Eng. & Educator Osama Ghandour
  • 2. LO CS.1.09 W5 : Students can design programs involving the logical operators and conditional statements. Lesson plan Python Eng. & Educator Osama Ghandour
  • 3. Warm Up Listen to this video Offline On line Python Eng. & Educator Osama Ghandour
  • 4. Warm up 5 min 1-Arithmetic Expressions . 2-Running and debagging programs. 3- if Statement , if else , nested if . 4- loops = “repetitions ” = donkey work =machine work , nested loops Eng. & Educator Osama Ghandour Python
  • 5. Anaconda : Spyder or an on line Python platform Inputs : 1- though console 2- input message 3- sensors 2- Dataset Python – Cheat sheets You can install python-2.7.17 or python-3.8.1 Write Program / Code Eng. & Educator Osama Ghandour Python
  • 6. Installing Anaconda Eng. & Educator Osama Ghandour
  • 7. Anaconda > Use Spyder Eng. & Educator Osama Ghandour Python
  • 8. Coding window – Ipython console - Variable explorer Spyder Eng. & Educator Osama Ghandour Eng. & Educator Osama Ghandour
  • 9. Compiling and interpreting in Python. Listen to this video Offline On line Offline On line Eng. & Educator Osama Ghandour Python
  • 10. Eng. & Educator Osama Ghandour
  • 11. Donkey work = repetition = iteration – loops – inside it there are conditions Eng. & Educator Osama Ghandour
  • 12. Further programming • Lab exercises – Let's go downstairs to the basement computer labs! • - learn prcticaly • What next? – Lists , Dictionaries , Algorithms etc. Eng. & Educator Osama Ghandour
  • 13. Essential Questions • Essential Questions: learn practically by designing a program which include 1- the logical operators and give some examples. 2- Comparing between if & switch statements and give some examples. 3- Write the general syntax of the conditional statements (if & switch). Eng. & Educator Osama Ghandour
  • 14. Evidence of Learning: Create a project with a programming language “Python” using Variables, Constants Arithmetic, and Assignment operators. Eng. & Educator Osama Ghandour
  • 15. 15 if  If statement: Executes a group of statements only if a certain condition is true. Otherwise, the statements are skipped.  Syntax: if condition: statements  Example: gpa = 3.4 if gpa > 2.0: print "Your application is accepted." Eng. & Educator Osama Ghandour
  • 16. 16 if/else  if/else statement: Executes one block of statements if a certain condition is True, and a second block of statements if it is False.  Syntax: if condition: statements else: statements  Example: gpa = 1.4 if gpa > 2.0: print "Welcome to Mars University!" else: print "Your application is denied."  Multiple conditions can be chained with elif ("else if"): if condition: statements elif condition: statements else: statements Eng. & Educator Osama Ghandour
  • 17. 17 while  while loop: Executes a group of statements as long as a condition is True.  good for indefinite loops (repeat an unknown number of times)  Syntax: while condition: statements  Example: number = 1 while number < 200: print number, number = number * 2  Output: 1 2 4 8 16 32 64 128 Eng. & Educator Osama Ghandour
  • 18. 18 Logic  Many logical expressions use relational operators:  Logical expressions can be combined with logical operators:  Exercise: Write code to display and count the factors of a number. Operator Example Result and 9 != 6 and 2 < 3 True or 2 == 3 or -1 < 5 True not not 7 > 0 False Operator Meaning Example Result == equals 1 + 1 == 2 True != does not equal 3.2 != 2.5 True < less than 10 < 5 False > greater than 10 > 5 True <= less than or equal to 126 <= 100 False >= greater than or equal to 5.0 >= 5.0 True home work Eng. & Educator Osama Ghandour
  • 19. Exercise : 19 • Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a grade using the following table: • Score Grade • >= 0.9 A • >= 0.8 B • >= 0.7 C • >= 0.6 D • < 0.6 F • ~~~ • Enter score: 0.95 A ~~ • Enter score: perfect • Bad score • Enter score: 10.0 • Bad score • Enter score: 0.75 • C • Enter score: 0.5 • F
  • 20. Dictionaries  Dictionaries • Dictionaries: curly brackets { } • What is dictionary? • Refer value through key; “associative arrays” • Like an array indexed by a string • An unordered set of key: value pairs • Values of any type; keys of almost any type • {"name":"Guido", "age":43, ("hello","world"):1, 42:"yes", "flag": ["red","white","blue"]} • d = { "foo" : 1, "bar" : 2 } print d["bar"] # 2 some_dict = {} some_dict["foo"] = "yow!" print some_dict.keys() # ["foo"] 20 Eng. & Educator Osama Ghandour
  • 21. 21 Eng. & Educator Osama Ghandour
  • 22. 22 Eng. & Educator Osama Ghandour
  • 23. functions  Functions in Python  Defining functions.  Return values.  Local variables.  Built-in functions.  Functions of functions.  Passing lists, dictionaries, and keywords to functions. 23 Eng. & Educator Osama Ghandour
  • 24. functions 24 Why functions? • It may not be clear why it is worth the trouble to divide a program into functions. • There are several reasons: • Creating a new function gives you an opportunity to name a group of statements, which makes your program easier to read, understand, and debug. • Functions can make a program smaller by eliminating repetitive code. Later, if you make a change, you only have to make it in one place. • Dividing a long program into functions allows you to debug the parts one at a time and then assemble them into a working whole. Well-designed functions are often useful for many programs. Once you write and debug one, you can reuse it Eng. & Educator Osama Ghandour
  • 25. functions  Define a Function: def  Define them in the file above the point they're used Body of the function should be indented consistently (4 spaces is typical in Python) Example: square.py def square(n): return n*n  print "The square of 3 is ", print square(3)  Output: The square of 3 is 9 25 Eng. & Educator Osama Ghandour
  • 26. functions  The def statement  The def statement is executed (that's why functions have to be defined before they're used) def creates an object and assigns a name to reference it; the function could be assigned another name, function names can be stored in a list, etc. Can put a def statement inside an if statement, etc! 26 Eng. & Educator Osama Ghandour
  • 28. functions Functions, Procedures def name(arg1, arg2, ...): """documentation"""# optional doc string statements return # from procedure return expression # from function 28 Eng. & Educator Osama Ghandour
  • 29. functions  More about functions  • Arguments are optional. Multiple arguments are separated by commas “ , ”. • If there's no return statement, then “None” is returned. Return values can be simple types or tuples. Return values may be ignored by the caller. • Functions are “typeless.” Can call with arguments of any type, so long as the operations in the function can be applied to the arguments. This is considered a good thing in Python 29 Eng. & Educator Osama Ghandour
  • 30. Connection to math Eng. & Educator Osama Ghandour Create, interpret and analyze quadratic functions that model real-world situations. W1-4 Key Concepts: o 1. Quadratic Function o 2. First and second differences o 3. Completing the square o 4. Complex numbers o 5. Parabola o 6. Focus o 7. Argand diagram o 8. related roots
  • 31. Mechanics Eng. & Educator Osama Ghandour Learning Outcome: Use position, displacement, average and instantaneous velocity, average and instantaneous acceleration to describe 1-dimensional motion of an object. W1-3 Key Concepts: o 1. Position /Time graphs o 2. velocity/Time graphs o 3. Acceleration /Time graphs o 4. Relative velocity. o 5. Instantaneous velocity o 6. Average velocity o 7. Reference Frames
  • 32. Mechanics Eng. & Educator Osama Ghandour Week 04 - Week 08 Learning Outcome: Use kinematic equations to understand and predict 1-dimensional motion of objects under constant acceleration,including vertical (free-fall) motion under gravity. Key Concepts:  1. Area under a curve  2. Kinematic equations for 1-D motion with constant acceleration  3. Free-fall motion
  • 33. Physics • . Fluids w1-3 • 2. Pressure • 3. Manometer • 4. Pressure gauge • 5. Units of pressure • 6. Effect of atmospheric pressure on boiling point of water • 7. Change in atmospheric pressure with altitude • 8. Pressure difference and force • 9. Archimedes Principle Eng. & Educator Osama Ghandour
  • 34. Check your email to Solve the Online auto answered quiz 15 min after school the quiz will be closed in 10:00pm after tomorrow Eng. & Educator Osama Ghandour Python
  • 35. Repetition (loops) in Python. Listen to this video Offline On line Offline On line Eng. & Educator Osama Ghandour Python
  • 36. Selection (if/else) in Python Listen to this video Offline On line Offline On line Eng. & Educator Osama Ghandour Python
  • 37. Read /write to Arduino pins Eng. & Educator Osama Ghandour
  • 38. Now you can plug the usb cable Eng. & Educator Osama Ghandour
  • 39. Run Arduino UNO with PyFirmata library Eng. & Educator Osama Ghandour
  • 40. Eng. & Educator Osama Ghandour
  • 41. Eng. & Educator Osama Ghandour
  • 42. Communicate with standard Firmata as downloading it to Arduino Eng. & Educator Osama Ghandour
  • 43. Now you can un plug Eng. & Educator Osama Ghandour
  • 44. Eng. & Educator Osama Ghandour
  • 45. Eng. & Educator Osama Ghandour
  • 46. Eng. & Educator Osama Ghandour
  • 47. Eng. & Educator Osama Ghandour
  • 48. Arduino Temperature control Eng. & Educator Osama Ghandour
  • 49. Eng. & Educator Osama Ghandour
  • 50. Eng. & Educator Osama Ghandour
  • 51. Eng. & Educator Osama Ghandour
  • 52. Eng. & Educator Osama Ghandour
  • 53. Eng. & Educator Osama Ghandour
  • 54. Eng. & Educator Osama Ghandour
  • 55. Eng. & Educator Osama Ghandour
  • 56. Eng. & Educator Osama Ghandour
  • 57. Evidence of Learning &home work • Start a task by 1- Create a project using logical operators and conditional statements. 2- Create a function with parameters and call it. • Complete the task as home work Eng. & Educator Osama Ghandour
  • 58. Summary 1-Using logical operators and give some examples. 2- using & Comparing between if &switch statements and give some examples. 3- Write the general syntax of the conditional statements (if& switch). Eng. & Educator Osama Ghandour Python
  • 59. Prepare for next week According to student’s law Gn=Wn % Ng CS.1.07 - 1- Gain knowledge and understanding the meaning of computer language? 2- Draw conclusions about concepts Eng. & Educator Osama Ghandour Python
  • 60. Reflection • Mention 2 things you learned today • What is your goal to accomplish in next week end in programming using Python? Eng. and Educator Osama Ghandour Python
  • 61. Home work (s. proj.) 1 you studied in physics about electric power and in your capstone about saving wasted energy so design a flowchart for Arduino control circuit to save the consumed energy in electric power circuit . Note : an ideal electric system has power factor PF=0.999 and very low reactive power. using logical operators and conditional statements beside a function with parameters , calling it to complete a program . Eng. and Educator Osama Ghandour Python
  • 62. Rubaric Blue student differentiate between / use logical operators and conditional statements with examples. Green student differentiate between / use logical operators and conditional statements . Yello w student mention features / use one of logical operators or conditional statements . Read student don`t have any idea about logical operators and conditional statements . Eng. and Educator Osama Ghandour Python
  • 63. Resources • https://www.youtube.com/watch?v=Rtww83GH 0BU • Other materials: • https://www.sololearn.com • https://www.w3schools.com • www.python.org Eng. and Educator Osama Ghandour Python
  • 65. Resources • https://www.youtube.com/user/osmgg2 Other materials: • https://www.sololearn.com • https://www.w3schools.com • www.python.org • “Learning Python,” 2nd edition, Mark Lutz and David Ascher (O'Reilly, Sebastopol, CA, 2004) (Thorough. Hard to get into as a quick read) Eng. & Educator Osama Ghandour Python
  • 66. Learn and practice through on line web sites https://www.thewebevolved.com https://www.123test.com/ https://www.wscubetech.com/ https://www.w3schools.com/ https://www.guru99.com https://codescracker.com/exam/review.php https://www.arealme.com/left-right-brain/en/ https://www.proprofs.com/ https://www.geeksforgeeks.org/ https://www.tutorialspoint.com https://www.sololearn.com http://www.littlewebhut.com/ Eng. & Educator Osama Ghandour Python
  • 67. If you do not feel happy, smile and pretend to be happy. • Smiling produces seratonin which is a neurotransmitter linked with feelings of happiness
  • 68. Thanks Eng. & Educator Osama Ghandour Python