icon-background-square
New
New
Year 8

Writing a text-based program

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

icon-background-square
New
New
Year 8

Writing a text-based program

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

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. 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 sequence of steps that can be followed to do a task.

  • 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.

Common misconception

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.

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.


To help you plan your year 8 computing lesson on: Writing a text-based program, download all teaching resources for free and adapt to suit your pupils' needs...

Outputs can be produced from various combinations of strings and variables used in different orders. Encourage pupils to adjust the output of programs to make sense grammatically to the user by varying the placement of the variables used.
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.
A program is a set of __________ that can be run by a computer.
Correct answer: commands
directions
points
facts
Q2.
An is a sequence of steps that can be followed to do a task.
Correct Answer: algorithm
Q3.
In this Scratch program, what is Hello World?
An image in a quiz
Correct answer: an output
an input
a variable
Q4.
In this Scratch program, what is the name of one of the variables?
An image in a quiz
Correct Answer: number, multiply-by
Q5.
A sequence is a precise set of instructions in a particular ...
Correct Answer: order, format, style, step
Q6.
What would be the output for the following algorithm:
123
Repeat 3 times: Draw ✳✳✳♡ Draw ♡✳
✳✳✳♡✳✳✳♡✳✳✳♡♡✳
Correct answer: ✳✳✳♡♡✳✳✳✳♡♡✳✳✳✳♡♡✳
✳✳✳♡♡✳♡✳♡✳
✳✳✳♡✳✳✳♡✳✳✳♡♡✳♡✳♡✳

5 Questions

Q1.
In programming, what is the term for the rules that specify the way that a program must be written?
algorithm
Correct answer: syntax
flowchart
command
Q2.
What type of error does the Python code
pint("Success")
have?
runtime error
Correct answer: syntax error
logic error
compilation error
Q3.
The Python code
Print("Hello World!")
has a syntax error. Rewrite the code correctly so that it doesn't have any syntax errors.
Correct Answer: print("Hello World!"), print ("Hello World!")
Q4.
Which function is used to display text or other information on the screen in Python?
input()
output()
Correct answer: `print()`
show()
Q5.
What is the output of the following Python code?
123
print("What is your name?") name = input() print(f"Hello {name}")
"What is your name? Hello"
Correct answer: "What is your name?" followed by "Hello" and the users input
"What is your name?" followed by "Hello name"
"Hello" followed by the user's input