Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Working with numerical inputs

      Lesson details

      Learning outcome

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

      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 computer’s memory which can be accessed and changed by a computer program

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

      • String - a sequence of characters, e.g. letters, numbers, spaces, and other 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.

      Teacher tip

      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.

      Equipment

      Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

      Licence

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

      Lesson video

      Loading...

      Prior knowledge starter quiz

      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
      Correct Answer:program,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

      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())
      Code colour

      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
      Code colour

      1 - calculate the multiplication
      2 - calculate the addition
      3 - assign the value to variable result

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