Download presentation
Presentation is loading. Please wait.
Published byArchibald Wood Modified over 9 years ago
1
Maths in Python [ slide 5 ] 1.Copy the table 2.Race a friend with a calculator to see whether Python is faster than a calculator: a) 5 * 6.5 = b)7 / 3 = c)128 + 6 = d)How many times does 120 divide by 7? e)What is the remainder of 120 / 7?
2
Combining Maths and Text [ slide 7 ] The print() function will print to screen: strings, numbers or calculations separated by commas: Interactive session: >>> print("111 divided by 4 = ", 111/4) 111 divided by 4 = 27.75 >>> print("11 divided by 4 = ", 11/4) 11 divided by 4 = 2.75 What will the output from this code produce? >>> print("11 divided by 4 = ", 11//4, "remainder ", 11%4) 11 divided by 4 = 2 remainder 3 >>> print("I will not write code in history lessons.\n" *50) See what else you can produce. Can you fill the screen with your name? Now try entering this code:
3
Lesson Summary In coding, snippets of text are called... [ slide 8 ] In this lesson you have: strings Whole numbers are called... integers Numbers with a decimal point are called... floating point numbers (or floats) To use special Python characters we need...escape sequences In Python, the remainder of a division is called... modulus 1.Learnt how to do more with text 2.Got Python to do some maths for you 3.Learnt how to combine maths and text
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.