## Fix the program below by identifying the issues in it:

``````Print(Hello world!")
Print(Get_input())``````

## Fix the program below by identifying the issues in it:

``````Print(Hello world!")
Print(Get_input())``````
``````print("Hello world!")
print(input())``````

# Maths and variables

## Learning Intentions

• Understand how to use maths in Python
• Understand how to use variables in Python
• Further our skills with input and output in Python

## Success Criteria

• I can develop my own calculator program
• I can use maths in Python
• I can explain why we use variables
• I can write variables in Python

## Maths in Python

• Maths in Python is very similar to how it is done in actual maths. For example, in maths you write 5 + 5 and in Python we just write 5 + 5.
• Here is a list of the different maths symbols we can use in Python:

## Maths in Python

``````print(5 + 5)
print(5 - 5)
print(5 * 5)
print(5 / 5)

print(5 + int(input()))
``````

## Algebra

y = 10

z = 2

x = y × z

What is x equal to?

## Algebra in Python

• Python uses something called variables to store values in the same way we use x, y and z in algebra.
• Variables are like a box that contains a single value:

## Python variables

``````y = 10
z = 2

x = y * z

print(x)
``````

## Why do we use variables?

• Variables store values in main memory so we can get the value from them later.
• If we take a user’s input and we want to add 5 to it and then print it, we would get a long statement.
• Variables make code easier to read.
``print(int(input()) + 5)``
``````user_input = int(input())
x = user_input + 5
print(x)``````
• Create a program to take a person’s name in and store it in a variable
• Print the user’s name on to the screen

Challenge

• Create a program that takes in two numbers and stores them in variables
• Create a third variable that stores the result of these two numbers being added together
• Print the third variable to the screen

Complete all tasks in the booklet from page 6 to page 17.

## Plenary

1. Grade yourself on the lesson's success criteria.

2. Colour in the box with the colour code shown to the right based on how well you think you’ve understood the concept.

• I can develop my own calculator program

• I can use maths in Python

• I can explain why we use variables

• I can write variables in Python

6 Software Development : 2.1 Maths and variables