Skip to content
Learnearn.uk » Python Unit Home » Python Maths

Python Maths

Starter

Have a go at the starter quiz below. P.s. you can click on the edit icon to see the Python code I used to make the quiz!


tricketediticon


Basic Arithmetic

Python maths symbols

maths-operators-bevel-and-shadow

Add             +

Subtract     –

Multiply    *

Divide       /

Power       **

 

Examples

 

Try typing these examples in to the interactive interpreter and see what results you get.

print(4+4)
 
print(5*6)
 
print(12/3)
 
print(5 - 9)

Practice - Part 1

Practice question 1
Use python to solve this maths question:

55+132

Practice question 2
Use python to solve this maths question:

456-123

Practice question 3
Use python to solve this maths question:

333*444+222-666


Introduction

Using maths with variables


It’s all very well doing maths, but if you are just typing in calculations, you might as well just be using a calculator! Maths really only starts to get useful in Python when we start storing the results of calculations. Once we have stored the result as a variable, we can either do more calculations we the result, print the number to the screen or do something else with the value.

Demo

y=4
z=x+y
print(z)
9

Practice - Part 2

Practice question 4
Use python to solve this maths question:

x = 45
y = 87
z = x + y

What is z?

Practice question 5
Use python to solve this maths question:

l = 10
w=20
a = l * w

  • What is the value of a?
  • What is this the equation for?

Practice question 6
Use python to solve this maths question:

pi = 3.142
r = 20
a = pi* r

  • What is the value of a?
  • What is this the equation for?

Introduction

Using maths with brackets


Just like in standard maths you can use parentheses (aka brackets) in Python. Though I bet in maths class making these kinds of calculations aren’t as easy as just typing in the code?

Demo


Practice Part - 3

Practice question 7

Use python to solve this maths question:

(4 * 4) + 4
Practice question 8
Use python to solve this maths question:

4 * (4 + 4)
Practice question 9
Use python to solve this maths question:

(25 + 45) / ( 5 + 5)

 

No challenges for this lesson. Phew! Just do the quiz on QuizMaster.

Have you…?

checklist2 Have you…

  • Added your finished challenges to your Quizmaster assignment?
  • Written down your homework ( Finish off unfinished challenges + learning logs)?

 

 

 

letslearnpython

Let’s learn Python – Integers, Floats and Maths

 

Plenary questions WIP

What is the proper name for math’s brackets?