SlideShare a Scribd company logo
Agenda of LO CS.1.07 W1
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
Warm Up
Listen to this video
Offline
On line
Python
Eng. & Educator Osama
Ghandour
Expressions
• expression: A data value or set of operations to compute
a value.
Examples: 1 + 4 * 3
42
• Arithmetic operators we will use:
– + - * / addition, subtraction/negation, multiplication,
division
– % modulus, a.k.a. remainder
– ** exponentiation
• precedence: Order in which operations are computed.
– * / % ** have a higher precedence than + -
1 + 3 * 4 is 13
– Parentheses can be used to force a certain order of evaluation.
(1 + 3) * 4 is 16
Eng. & Educator Osama
Ghandour
Revision
Numbers
• The usual suspects
• 12, 3.14, 0xFF, 0377, (-1+2)*3/4**5, abs(x), 0<x<=5
• C-style shifting & masking
• 1<<16, x&0xff, x|1, ~x, x^y
• Integer division truncates :-(
• 1/2 -> 0 # 1./2. -> 0.5, float(1)/2 -> 0.5
• Will be fixed in the future
• Long (arbitrary precision), complex
• 2L**100 -> 1267650600228229401496703205376L
– In Python 2.2 and beyond, 2**100 does the same thing
• 1j**2 -> (-1+0j) Eng. & Educator Osama
Ghandour
Revision
Variables
• variable: A named piece of memory that can store a value.
– Usage:
• Compute an expression's result,
• store that result into a variable,
• and use that variable later in the program.
• assignment statement: Stores a value into a variable.
– Syntax:
name = value
– Examples: x = 5
gpa = 3.14
x 5 gpa 3.14
– A variable that has been given a value can be used in expressions.
x + 4 is 9
• Exercise: Evaluate the quadratic equation for a given a, b, and c.
Eng. & Educator Osama
Ghandour
Revision
Syntax:
print "Message"
print Expression
–Prints the given text message or expression value on the
console, and moves the cursor down to the next line.
print Item1, Item2, ..., ItemN
–Prints several messages and/or expressions on the same line.
• Examples:
print "Hello, world!"
age = 45
print "You have", 65 - age, "years until
retirement"
Output:
Hello, world!
You have 20 years until retirement
print
Eng. & Educator Osama
Ghandour
Revision
•input : Reads a number from user input.
–You can assign (store) the result of input into a variable.
–Example:
age = input("How old are you? ")
print "Your age is", age
print "You have", 65 - age, "years until
retirement"
Output:
How old are you? 53
Your age is 53
You have 12 years until retirement
• Exercise: Write a Python program that prompts the
user for his/her amount of money, then reports how
many Nintendo Wiis the person can afford, and how
much more money he/she will need to afford an
additional Wii.
Input
Eng. & Educator Osama
Ghandour
Revision
Eng. & Educator Osama
Ghandour
Revision
Essential Questions
• 1- What is the different between
the data types? 2- What is the
different between the Constants
and Variables? 3- How can test a
program and debug its errors? 4-
Mission the Arithmetic and
Assignment Operators, and give
some examples.
Eng. & Educator Osama Ghandour
Textbook and Resource
Materials:
• https://www.w3schools.com/pytho
n/python_operators.asp
Evidence of Learning: create a
project with programming
language using Variables,
Constants Arithmetic, and
Assignment operators .
Eng. & Educator Osama
Ghandour
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
Connecting to 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
Repetition (loops)
and Selection (if/else)
What we will Learn today
?
Donkey work =
repetition = iteration –
loops – inside it there
are conditions
Text processing
• text processing: Examining, editing, formatting text.
– often uses loops that examine the characters of a string one
by one
• A for loop can examine each character in a string in
sequence.
– Example:
for c in "booyah":
print c
Output:
b
o
o
y
a
h
Eng. & Educator Osama
Ghandour
Strings and numbers
• ord(text) - converts a string into a
number.
– Example: ord("a") is 97, ord("b") is 98, ...
– Characters map to numbers using standardized
mappings such as ASCII and Unicode.
• chr(number) - converts a number into a string.
– Example: chr(99) is "c"
• Exercise: Write a program that performs a rotation
cypher.
– e.g. "Attack" when rotated by 1 becomes "buubdl"
Eng. & Educator Osama
Ghandour
Python
DrawingPanel
• To create a window, create a drawingpanel
and its graphical pen, which we'll call g :
from drawingpanel import *
panel = drawingpanel(width, height)
g = panel.get_graphics()
... (draw shapes here) ...
panel.mainloop()
• The window has nothing on it, but we can
draw shapes and
lines on it by sending commands to g .
– Example:
g.create_rectangle(10, 30, 60, 35)
g.create_oval(80, 40, 50, 70)
g.create_line(50, 50, 90, 70)
Eng. & Educator Osama
Ghandour
Graphical commands
Command Description
g.create_line(x1, y1, x2, y2) a line between (x1, y1), (x2, y2)
g.create_oval(x1, y1, x2, y2) the largest oval that fits in a box with
top-left corner at (x1, y1) and bottom-
left corner at (x2, y2)
g.create_rectangle(x1, y1, x2, y2) the rectangle with top-left corner at
(x1, y1), bottom-left at (x2, y2)
g.create_text(x, y, text="text") the given text at (x, y)
• The above commands can accept optional outline and fill
colors.
g.create_rectangle(10, 40, 22, 65,
fill="red", outline="blue")
• The coordinate system is y-inverted:
(0, 0)
(200, 100)
Eng. & Educator Osama
Ghandour
Drawing with loops
• We can draw many repetitions of the
same item at different x/y positions with
for loops.
– The x or y assignment expression contains
the loop counter, i, so that in each pass of
the loop, when i changes, so does x or y.
from drawingpanel import *
window = drawingpanel(500, 400)
g = window.get_graphics()
for i in range(1, 11):
x = 100 + 20 * i
y = 5 + 20 * i
g.create_oval(x, y, x + 50, y + 50, fill="red")
window.mainloop()
• Exercise: Draw the figure at right.
Eng. & Educator Osama Ghandour
Further programming
• Lab exercises
– Let's go downstairs to the basement computer
labs!
– All resources are available at the following URL:
• http://faculty.washington.edu/stepp/cs4hs/
• What next?
– Lists , Dictionaries , data structures
– Algorithms: searching, sorting, recursion, etc.
– Objects and object-oriented programming
– Graphical user interfaces, event-driven
programming 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
Summary
1-Repetition (loops).
2- Selection (if/else).
3- Compile the program (Run).
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
• What is your goal to accomplish in
next week End Using Python?
Eng. and Educator Osama
Ghandour
Python
Home work (s. proj.) 1
• Create a presentation contains some
concepts of computer languages (Python)
and display the Concepts of Repetition
(loops) and Selection (if/else)following the
bellow rubric .
Eng. and Educator Osama
Ghandour
Python
Home work (s. project.) 2
• you studied in physics about
• electric power and in your capstone about
saving wasted energy or saving or
generating enegy in personla scale 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.
• .
Eng. and Educator Osama Ghandour
Python
Rubaric
Blue
Design a presentation showing Python to contain some
concepts Repetition (loops)
and Selection (if/else)
Green
Design a presentation showing Python to contain one or
2 Repetition (loops) and Selection (if/else).
Yello
w
missing two points of green level.
Read No presentation .
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
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
Thanks
Engineer and educator/ Osama G. Geris
Eng. & Educator Osama
Ghandour
Python

More Related Content

PPTX
Programming intro variables constants - arithmetic and assignment operators
Osama Ghandour Geris
 
PPT
Python week 1 2020-2021
Osama Ghandour Geris
 
PPT
Python week 5 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
Python cs.1.12 week 10 2020 2021 covid 19 for g10 by eng.osama mansour
Osama Ghandour Geris
 
PPT
Python week 2 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
Python week 7 8 2019-2020 for grade 10
Osama Ghandour Geris
 
PPT
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
Python week 6 2019 2020 for grade 10
Osama Ghandour Geris
 
Programming intro variables constants - arithmetic and assignment operators
Osama Ghandour Geris
 
Python week 1 2020-2021
Osama Ghandour Geris
 
Python week 5 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Python cs.1.12 week 10 2020 2021 covid 19 for g10 by eng.osama mansour
Osama Ghandour Geris
 
Python week 2 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Python week 7 8 2019-2020 for grade 10
Osama Ghandour Geris
 
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Python week 6 2019 2020 for grade 10
Osama Ghandour Geris
 

What's hot (20)

PPT
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
Python week 5 2019-2020 for G10 by Eng.Osama Ghandour.ppt
Osama Ghandour Geris
 
PPTX
Python basics
TIB Academy
 
PDF
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Edureka!
 
PDF
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
PPTX
Python Tutorial Part 1
Haitham El-Ghareeb
 
PPTX
Introduction to Python Programming
Akhil Kaushik
 
PPTX
Intro to Data Structure & Algorithms
Akhil Kaushik
 
PPTX
Algorithms & Complexity Calculation
Akhil Kaushik
 
PDF
Introduction to python programming
Srinivas Narasegouda
 
PDF
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
PDF
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Universitat Politècnica de Catalunya
 
DOCX
PYTHON NOTES
Ni
 
ODP
Python and Machine Learning
trygub
 
PPS
Slides
xbj25kl
 
PPTX
Chapter 02 functions -class xii
Praveen M Jigajinni
 
PPTX
Full Python in 20 slides
rfojdar
 
PDF
Attention mechanisms with tensorflow
Keon Kim
 
PPTX
Introduction to Structure Programming with C++
Mohamed Essam
 
PPTX
11 Unit 1 Chapter 02 Python Fundamentals
Praveen M Jigajinni
 
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Python week 5 2019-2020 for G10 by Eng.Osama Ghandour.ppt
Osama Ghandour Geris
 
Python basics
TIB Academy
 
Python Loops Tutorial | Python For Loop | While Loop Python | Python Training...
Edureka!
 
Chapter 0 Python Overview (Python Programming Lecture)
IoT Code Lab
 
Python Tutorial Part 1
Haitham El-Ghareeb
 
Introduction to Python Programming
Akhil Kaushik
 
Intro to Data Structure & Algorithms
Akhil Kaushik
 
Algorithms & Complexity Calculation
Akhil Kaushik
 
Introduction to python programming
Srinivas Narasegouda
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Attention-based Models (DLAI D8L 2017 UPC Deep Learning for Artificial Intell...
Universitat Politècnica de Catalunya
 
PYTHON NOTES
Ni
 
Python and Machine Learning
trygub
 
Slides
xbj25kl
 
Chapter 02 functions -class xii
Praveen M Jigajinni
 
Full Python in 20 slides
rfojdar
 
Attention mechanisms with tensorflow
Keon Kim
 
Introduction to Structure Programming with C++
Mohamed Essam
 
11 Unit 1 Chapter 02 Python Fundamentals
Praveen M Jigajinni
 
Ad

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

DOCX
Python Math Concepts Book
Rohan Karunaratne
 
PDF
Introduction To Programming with Python
Sushant Mane
 
PPTX
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
 
PPTX
Introduction to Python Basics for PSSE Integration
FarhanKhan978284
 
DOCX
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
priestmanmable
 
PDF
introduction to python programming course 2
FarhadMohammadRezaHa
 
PDF
Python: An introduction A summer workshop
ForrayFerenc
 
PDF
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
PDF
Introduction to python
Ahmed Salama
 
PDF
Introduction to Python
UC San Diego
 
PPTX
if, while and for in Python
PranavSB
 
PPTX
Introduction_to_Python_operators_datatypes.pptx
MadhusmitaSahu40
 
PPTX
Q-SPractical_introduction_to_Python.pptx
JeromeTacata3
 
PPTX
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
nyomans1
 
DOCX
python isn't just a snake
geekinlibrariansclothing
 
PPT
python fundamental for beginner course .ppt
samuelmegerssa1
 
PPTX
Brixton Library Technology Initiative Week0 Recap
Basil Bibi
 
PDF
Python for Physical Science.pdf
MarilouANDERSON
 
PDF
Programming And Scientific Computing In Python 60 Jm Hoekstra
letonakanoor
 
Python Math Concepts Book
Rohan Karunaratne
 
Introduction To Programming with Python
Sushant Mane
 
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
 
Introduction to Python Basics for PSSE Integration
FarhanKhan978284
 
ISTA 130 Lab 21 Turtle ReviewHere are all of the turt.docx
priestmanmable
 
introduction to python programming course 2
FarhadMohammadRezaHa
 
Python: An introduction A summer workshop
ForrayFerenc
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
Introduction to python
Ahmed Salama
 
Introduction to Python
UC San Diego
 
if, while and for in Python
PranavSB
 
Introduction_to_Python_operators_datatypes.pptx
MadhusmitaSahu40
 
Q-SPractical_introduction_to_Python.pptx
JeromeTacata3
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
nyomans1
 
python isn't just a snake
geekinlibrariansclothing
 
python fundamental for beginner course .ppt
samuelmegerssa1
 
Brixton Library Technology Initiative Week0 Recap
Basil Bibi
 
Python for Physical Science.pdf
MarilouANDERSON
 
Programming And Scientific Computing In Python 60 Jm Hoekstra
letonakanoor
 
Ad

More from Osama Ghandour Geris (20)

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

Recently uploaded (20)

PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
CDH. pptx
AneetaSharma15
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 

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

  • 1. Agenda of LO CS.1.07 W1 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. Warm Up Listen to this video Offline On line Python Eng. & Educator Osama Ghandour
  • 3. Expressions • expression: A data value or set of operations to compute a value. Examples: 1 + 4 * 3 42 • Arithmetic operators we will use: – + - * / addition, subtraction/negation, multiplication, division – % modulus, a.k.a. remainder – ** exponentiation • precedence: Order in which operations are computed. – * / % ** have a higher precedence than + - 1 + 3 * 4 is 13 – Parentheses can be used to force a certain order of evaluation. (1 + 3) * 4 is 16 Eng. & Educator Osama Ghandour Revision
  • 4. Numbers • The usual suspects • 12, 3.14, 0xFF, 0377, (-1+2)*3/4**5, abs(x), 0<x<=5 • C-style shifting & masking • 1<<16, x&0xff, x|1, ~x, x^y • Integer division truncates :-( • 1/2 -> 0 # 1./2. -> 0.5, float(1)/2 -> 0.5 • Will be fixed in the future • Long (arbitrary precision), complex • 2L**100 -> 1267650600228229401496703205376L – In Python 2.2 and beyond, 2**100 does the same thing • 1j**2 -> (-1+0j) Eng. & Educator Osama Ghandour Revision
  • 5. Variables • variable: A named piece of memory that can store a value. – Usage: • Compute an expression's result, • store that result into a variable, • and use that variable later in the program. • assignment statement: Stores a value into a variable. – Syntax: name = value – Examples: x = 5 gpa = 3.14 x 5 gpa 3.14 – A variable that has been given a value can be used in expressions. x + 4 is 9 • Exercise: Evaluate the quadratic equation for a given a, b, and c. Eng. & Educator Osama Ghandour Revision
  • 6. Syntax: print "Message" print Expression –Prints the given text message or expression value on the console, and moves the cursor down to the next line. print Item1, Item2, ..., ItemN –Prints several messages and/or expressions on the same line. • Examples: print "Hello, world!" age = 45 print "You have", 65 - age, "years until retirement" Output: Hello, world! You have 20 years until retirement print Eng. & Educator Osama Ghandour Revision
  • 7. •input : Reads a number from user input. –You can assign (store) the result of input into a variable. –Example: age = input("How old are you? ") print "Your age is", age print "You have", 65 - age, "years until retirement" Output: How old are you? 53 Your age is 53 You have 12 years until retirement • Exercise: Write a Python program that prompts the user for his/her amount of money, then reports how many Nintendo Wiis the person can afford, and how much more money he/she will need to afford an additional Wii. Input Eng. & Educator Osama Ghandour Revision
  • 8. Eng. & Educator Osama Ghandour Revision
  • 9. Essential Questions • 1- What is the different between the data types? 2- What is the different between the Constants and Variables? 3- How can test a program and debug its errors? 4- Mission the Arithmetic and Assignment Operators, and give some examples. Eng. & Educator Osama Ghandour
  • 10. Textbook and Resource Materials: • https://www.w3schools.com/pytho n/python_operators.asp Evidence of Learning: create a project with programming language using Variables, Constants Arithmetic, and Assignment operators . Eng. & Educator Osama Ghandour
  • 11. 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
  • 12. 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
  • 13. Connecting to 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
  • 14. 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
  • 15. Repetition (loops) and Selection (if/else) What we will Learn today ?
  • 16. Donkey work = repetition = iteration – loops – inside it there are conditions
  • 17. Text processing • text processing: Examining, editing, formatting text. – often uses loops that examine the characters of a string one by one • A for loop can examine each character in a string in sequence. – Example: for c in "booyah": print c Output: b o o y a h Eng. & Educator Osama Ghandour
  • 18. Strings and numbers • ord(text) - converts a string into a number. – Example: ord("a") is 97, ord("b") is 98, ... – Characters map to numbers using standardized mappings such as ASCII and Unicode. • chr(number) - converts a number into a string. – Example: chr(99) is "c" • Exercise: Write a program that performs a rotation cypher. – e.g. "Attack" when rotated by 1 becomes "buubdl" Eng. & Educator Osama Ghandour Python
  • 19. DrawingPanel • To create a window, create a drawingpanel and its graphical pen, which we'll call g : from drawingpanel import * panel = drawingpanel(width, height) g = panel.get_graphics() ... (draw shapes here) ... panel.mainloop() • The window has nothing on it, but we can draw shapes and lines on it by sending commands to g . – Example: g.create_rectangle(10, 30, 60, 35) g.create_oval(80, 40, 50, 70) g.create_line(50, 50, 90, 70) Eng. & Educator Osama Ghandour
  • 20. Graphical commands Command Description g.create_line(x1, y1, x2, y2) a line between (x1, y1), (x2, y2) g.create_oval(x1, y1, x2, y2) the largest oval that fits in a box with top-left corner at (x1, y1) and bottom- left corner at (x2, y2) g.create_rectangle(x1, y1, x2, y2) the rectangle with top-left corner at (x1, y1), bottom-left at (x2, y2) g.create_text(x, y, text="text") the given text at (x, y) • The above commands can accept optional outline and fill colors. g.create_rectangle(10, 40, 22, 65, fill="red", outline="blue") • The coordinate system is y-inverted: (0, 0) (200, 100) Eng. & Educator Osama Ghandour
  • 21. Drawing with loops • We can draw many repetitions of the same item at different x/y positions with for loops. – The x or y assignment expression contains the loop counter, i, so that in each pass of the loop, when i changes, so does x or y. from drawingpanel import * window = drawingpanel(500, 400) g = window.get_graphics() for i in range(1, 11): x = 100 + 20 * i y = 5 + 20 * i g.create_oval(x, y, x + 50, y + 50, fill="red") window.mainloop() • Exercise: Draw the figure at right. Eng. & Educator Osama Ghandour
  • 22. Further programming • Lab exercises – Let's go downstairs to the basement computer labs! – All resources are available at the following URL: • http://faculty.washington.edu/stepp/cs4hs/ • What next? – Lists , Dictionaries , data structures – Algorithms: searching, sorting, recursion, etc. – Objects and object-oriented programming – Graphical user interfaces, event-driven programming Eng. & Educator Osama Ghandour
  • 23. 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
  • 24. Repetition (loops) in Python. Listen to this video Offline On line Offline On line Eng. & Educator Osama Ghandour Python
  • 25. Selection (if/else) in Python Listen to this video Offline On line Offline On line Eng. & Educator Osama Ghandour Python
  • 26. Read /write to Arduino pins Eng. & Educator Osama Ghandour
  • 27. Now you can plug the usb cable Eng. & Educator Osama Ghandour
  • 28. Run Arduino UNO with PyFirmata library Eng. & Educator Osama Ghandour
  • 29. Eng. & Educator Osama Ghandour
  • 30. Eng. & Educator Osama Ghandour
  • 31. Communicate with standard Firmata as downloading it to Arduino Eng. & Educator Osama Ghandour
  • 32. Now you can un plug Eng. & Educator Osama Ghandour
  • 33. Eng. & Educator Osama Ghandour
  • 34. Eng. & Educator Osama Ghandour
  • 35. Eng. & Educator Osama Ghandour
  • 36. Eng. & Educator Osama Ghandour
  • 37. Arduino Temperature control Eng. & Educator Osama Ghandour
  • 38. Eng. & Educator Osama Ghandour
  • 39. Eng. & Educator Osama Ghandour
  • 40. Eng. & Educator Osama Ghandour
  • 41. Summary 1-Repetition (loops). 2- Selection (if/else). 3- Compile the program (Run). Eng. & Educator Osama Ghandour Python
  • 42. 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
  • 43. Reflection • What is your goal to accomplish in next week End Using Python? Eng. and Educator Osama Ghandour Python
  • 44. Home work (s. proj.) 1 • Create a presentation contains some concepts of computer languages (Python) and display the Concepts of Repetition (loops) and Selection (if/else)following the bellow rubric . Eng. and Educator Osama Ghandour Python
  • 45. Home work (s. project.) 2 • you studied in physics about • electric power and in your capstone about saving wasted energy or saving or generating enegy in personla scale 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. • . Eng. and Educator Osama Ghandour Python
  • 46. Rubaric Blue Design a presentation showing Python to contain some concepts Repetition (loops) and Selection (if/else) Green Design a presentation showing Python to contain one or 2 Repetition (loops) and Selection (if/else). Yello w missing two points of green level. Read No presentation . Eng. and Educator Osama Ghandour Python
  • 47. 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
  • 48. 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
  • 49. 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
  • 50. Thanks Engineer and educator/ Osama G. Geris Eng. & Educator Osama Ghandour Python