year 7 lesson 2 text and maths
DESCRIPTION
Lesson 2 - Text and MathsTRANSCRIPT
TEXT
& MAT
HS IN
PYTH
ON
L ES
SO
N 2
LESSON OBJECTIVES
Learn how to use Python to work out maths calculations.
LESSON OUTCOMES
I can use more text in Python ... I can use basic maths in Python ... I can use both text and maths in Python programming ...
[ slide 4 ]
STARTEREscape sequences have a special purpose in Python.
See below:
Complete Task 1 on Worksheet 2 to try out escape sequences in your own code.
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...
[ slide 5 ]
PYTHON AS A CALCULATOR
Now complete Task 2 on Worksheet 2 to try out some more basic maths in Python.
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...
Open Python Shell and have a go at the calculations in the table below:
MINI PLENARY
In pairs try
the Mini Plenary task on Worksheet 2.
Did the calculator beat Python??
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...
[ slide 7 ]
COMBINING MATHS & TEXT
What will the output from this code produce?
>>> print("11 divided by 4 = ", 11//4, "remainder ", 11%4)
>>> print("111 divided by 4 = ", 111/4)
>>> print("11 divided by 4 = ", 11/4)
Now try Task 3 on Worksheet 2.
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...
MORE TEXT AND MATHS ...
We can use text to label numbers for example: coins = 20 Why???
Reason: If we need to demonstrate how many coins we own more than once and the value of the coins change, we only need to change the number at the start of the program once.
As programmers this can saves us lots of time.
Now try Task 4 on Worksheet 2.
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...
[ slide 8 ]
PLENARY
The escape sequence \n is used to create a ...
The escape sequence \t is used to create a ...
The operator * is used to ...
The operator / is used to ...
The operator // is used to ...
You can also f.... numbers to create a decimal.
Lesson outcomes I can use more text in Python ...
I can use basic maths in Python ...
I can use both text and maths in Python programming ...