Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Input

Numeric input

301.6 Input

Practise exam questions

Input — Note 2 of 3

Cast input to numbers.

What you need to know

Since input() always returns a string, you must cast it to int or float before doing maths. Wrap the input() call inside int() or float().

What to know

  • int(input("Age: ")) converts to integer in one line
  • float(input("Price: ")) for decimals
  • Without casting, + concatenates instead of adding
  • Invalid input (e.g. letters for int) causes ValueError

Code examples

Numeric input
python
age = int(input("Enter your age: "))
next_year = age + 1
print("Next year you will be", next_year)
← Previous noteInput basics301.6 InputNext note →IPO Pattern301.6 Input

Back to Input

Specification notes for programming are in Paper 2.

Input

Note 2 of 3

  1. 1Input basics
  2. 2Numeric input
  3. 3IPO Pattern
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).