icon-background-square
New
New
Year 8

Working with numerical inputs

I can use arithmetic expressions to calculate values and store these values in variables in a program.

icon-background-square
New
New
Year 8

Working with numerical inputs

I can use arithmetic expressions to calculate values and store these values in variables in a program.

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. Variables are used to store and reference values.
  2. An assignment is an instruction that can set a variable with a provided value.
  3. Arithmetic expressions can be used to calculate values.
  4. The result of an expression can be used for assignment.
  5. Numerical inputs need to be converted to numbers when they are used in expressions.

Keywords

  • Variable - A named piece of data, stored in a memory location in a computer. The data can change as needed.

  • Operator - A symbol or word that instructs the computer to perform a specific calculation or action.

  • String - A sequence of characters which could be a combination of letters, numbers, spaces or symbols.

  • Integer - A whole number that can be positive, negative, or zero.

Common misconception

Pupils often take user input for numerical values and then cannot perform arithmetic calculations on the data as the value is automatically stored as a string.

The int() function is used to convert a user's input to an integer so that calculations can then be performed. For example, age = int(input()) would allow a user to input their age in to a program.


To help you plan your year 8 computing lesson on: Working with numerical inputs, download all teaching resources for free and adapt to suit your pupils' needs...

The order of arithmetic expressions in Python affects the output of the calculation. Encourage pupils to experiment with different combinations and orders in arithmetic expressions and test the output.
speech-bubble
Teacher tip
equipment-required

Equipment

All pupils requires access to devices that can edit and run Python programs. Starter code files are available to copy or use directly via the Raspberry Pi Code Editor.

copyright

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is an algorithm?
a specific programming language
a computer program
Correct answer: a set of step-by-step instructions to solve a problem
a type of computer hardware
Q2.
Which of the following is the most accurate and complete definition of a computer program?
a step-by-step solution to a problem
Correct answer: a set of commands written in a specific language that a computer can run
a series of instructions designed to achieve a specific outcome
a graphical representation of a process
Q3.
Match the following terms with their definitions
Correct Answer:algorithm,a step-by-step procedure for solving a problem
tick

a step-by-step procedure for solving a problem

Correct Answer:program,a set of instructions that tells a computer what to do
tick

a set of instructions that tells a computer what to do

Correct Answer:syntax,the rules that govern how code is written in a programming language
tick

the rules that govern how code is written in a programming language

Q4.
In Python, which function is used to display text on the screen?
input()
output()
Correct answer: `print()`
show()
Q5.
Identify the code that does not include a syntax error.
Correct answer: `print ("Hello")`
print(Hello")
print("Hello"
PRINT("Hello")
Q6.
What happens if a program contains a syntax error?
Correct answer: It will not run.
It will run and work correctly.
It will run, but will not work correctly.

6 Questions

Q1.
Which function in Python is used to get input from the user?
print()
get()
Correct answer: `input()`
ask()
Q2.
What data type does the
input()
function in Python always return?
Correct Answer: string, String, STRING
Q3.
Which Python function is used to convert a string representing a whole number into an integer?
print()
input()
Correct answer: `int()`
len()
Q4.
In Python, what does the following code do?
123
print("Enter your age: ") age = int(input())
calculates the user's age
prints the user's age
Correct answer: asks the user for their age and stores it as an integer
asks the user for their age and stores it as a string
Q5.
An is a numerical data type which holds a whole number that can be positive, negative, or zero.
Correct Answer: integer, Integer, int, int()
Q6.
Arrange the following steps in the correct order to calculate the result of this Python expression:
1
result = 2 + 4 * 6
1 - calculate the multiplication
2 - calculate the addition
3 - assign the value to variable result