Understand and interpret concept the loop statements and give some examples. • Students can design programs involving loop statements. • Gain knowledge and understanding of function of the loops inside the program. • Students can compare between loop statements , Iteration. , Loop structure, While - Do while, For - Loop control statement (start, end and step).
, Control all loops by break & continue statements, Infinite loop,Explain the different loops available in language with examples, Differ between loop control statement and the infinite loop , by Eng.&Educator Osama Ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
1. Agenda of LO CS.1.11 W7-8
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.11 W7 :
Understand and interpret concept
the loop statements and give some
examples. • Students can design
programs involving loop
statements. • Gain knowledge and
understanding of function of the
loops inside the program. •
Students can compare between
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-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
5. 5
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
6. 6
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
7. 7
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
8. 8
Relational VS 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
Eng. & Educator Osama Ghandour
10. 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
11. 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
15. Essential Questions
• Essential Questions:
1- What is the function
of the loop statement?
2- What is the general
syntax of the loop
statements? Eng. & Educator Osama
Ghandour
16. Essential Questions
• Essential Questions:
3- Write a code to repeat a
text "Egypt" 5 times.
4- Write a code to display
the odd, even numbers
from 0 to 10 and their sum.
Eng. & Educator Osama
Ghandour
17. Essential Questions
• Essential Questions:
5- Write a code to
display the integer
numbers between 1 to
100 divisible by 7
Eng. & Educator Osama
Ghandour
18. Types of loops in python .
Listen to this video
Offline On line
Offline On line
Eng. & Educator Osama
Ghandour
Python
19. 19
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
Iteration Loop structure
21. Types of loops in python .
Listen to this video
Offline On line
Offline On line
Eng. & Educator Osama
Ghandour
Python
22. For loop
sume = 0
sumo = 0
for x in range (11):
if x%2==0:
print (x , "is even number")
sume=sume+x
else :
print (x , "is odd number")
sumo=sumo+x
print (sume , "summestion of even numbers")
print (sumo , "summestion of odd numbers")
Eng. & Educator Osama
Ghandour
23. • 0 is even number
• 1 is odd number
• 2 is even number
• 3 is odd number
• 4 is even number
• 5 is odd number
• 6 is even number
• 7 is odd number
• 8 is even number
• 9 is odd number
• 10 is even number
• 30 summestion of even numbers
• 25 summestion of odd numbers
Eng. & Educator Osama
Ghandour
25. Evidence of Learning:
Create a project with a
programming language
“Python” using different types
of Loops.
Eng. & Educator Osama
Ghandour
26. 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
27. 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
28. 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
29. 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
30. Check your email to Solve the
Online auto answered
quiz 15 min after
school the quiz will be
closed in 10:00pm
after
tomorrowEng. & Educator Osama
Ghandour
Python
48. 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
49. Summary
1-Types of Loops.
2- while loop.
3- for loop
4-Loop control statement (start, end
and step).
5- Control all loops by break &
continue statements.
6- Infinite loop
Eng. & Educator Osama
Ghandour
Python
50. 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 conceptsEng. & Educator Osama
Ghandour
Python
51. 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
52. 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 loops and previous concepts
as logical operators and conditional
statements beside a function with
parameters , calling it to complete a
program / project. Eng. and Educator Osama Ghandour
Python
53. Rubaric
Blue
student differentiate between / using different types of
Loops with examples.
Green
student differentiate between / use using different
types of Loops .
Yello
w
student mention features / use one of type of loops .
Read student don`t have any idea loops .
Eng. and Educator Osama
Ghandour
Python
56. 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
57. 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
58. If you do not feel happy, smile
and pretend to be happy.
• Smiling produces seratonin
which is a neurotransmitter
linked with feelings of
happiness