Back to Input/output

Oak National Academy

Lessons written by expert teachers in England, each with slides, a video and quizzes.

Their topic:
Programming: iteration · Introduction to Python programming
For your topic:
Input/output · Computer Science - 4CP0

Use these lessons alongside our lesson note, which covers your syllabus in full.

What this covers in your syllabus

2 lessons from Oak National Academy

Lesson 1 of 2 · GCSE level, ages 14 to 16

Validating data input in a program

By the end: I can explain the purpose of validation checks and use iteration to ensure data entered is reasonable.

Key learning points

  1. Validation checks are used to ensure that data that is entered is reasonable and expected.
  2. Iteration is used to ensure the validation checks are implemented correctly.

Keywords

validation
checking that data is acceptable by comparing it against a set of criteria
crash
when a program suddenly stops working and closes unexpectedly, often due to an error it cannot recover from

A common mistake

Mistake: A program will automatically ask people to try again if data is invalid.

In fact: The program will only ask for data to be input again if it has been programmed to do so; otherwise it will run with invalid data and may crash.

Check what you learned

From Oak National Academy's exit quiz. Choose every answer that is right.

Which of the following is an example of validation?
What happens if a program does not explicitly include instructions to handle invalid data?
What is the purpose of a validation error message?

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

Lesson 2 of 2 · Lower secondary, ages 11 to 14

Writing a text-based program

By the end: I can create a text-based program from an algorithm that includes input and output.

Take the full lesson on Oak National Academy The video, slides and quizzes for this lesson are on Oak National Academy's site.

Key learning points

  1. An algorithm is a sequence of steps that can be followed to do a task.
  2. A program is a set of commands that can be run by a computer in order for it to do a task.
  3. All programming languages have rules for syntax that must be followed so that the program can run.
  4. The print() function is used to output information from a Python program.
  5. The input() function is used to input data from the user into a Python program.

Keywords

algorithm
a set of step-by-step instructions to solve a problem
program
a set of commands that can be run by a computer in order for it to do a task
syntax
the precise way that a program must be written to be understood by a computer

A common mistake

Mistake: Pupils will modify their code to provide input directly in to the input() function, for example, user = input("Aisha"), rather than typing when asked as the program runs.

In fact: The computer follows the instructions of a program. Input that a user has to type in should only be entered when the program runs. This allows different users to provide different inputs without changing the program in any way.

A computing lesson by Oak National Academy licensed under the Open Government Licence (OGL) v3.0. Read the licence

The wording comes from each publisher. The layout and the links to your syllabus are ours.