Starter quiz
- What is an algorithm?
- a specific programming language
- a computer program
- a set of step-by-step instructions to solve a problem ✓
- a type of computer hardware
-
- Which of the following is the most accurate and complete definition of a computer program?
- a step-by-step solution to a problem
- 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
-
- Match the following terms with their definitions
- algorithm⇔a step-by-step procedure for solving a problem ✓
- program⇔a set of instructions that tells a computer what to do ✓
- syntax⇔the rules that govern how code is written in a programming language ✓
- In Python, which function is used to display text on the screen?
- `input()`
- `output()`
- `print()` ✓
- `show()`
-
- Identify the code that does not include a syntax error.
- `print ("Hello")` ✓
- `print(Hello")`
- `print("Hello"`
- `PRINT("Hello")`
-
- What happens if a program contains a syntax error?
- It will not run. ✓
- It will run and work correctly.
- It will run, but will not work correctly.
-
Exit quiz
- Which function in Python is used to get input from the user?
- `print()`
- `get()`
- `input()` ✓
- `ask()`
-
- What data type does the `input()` function in Python always return?
- 'string' ✓
- Which Python function is used to convert a string representing a whole number into an integer?
- `print()`
- `input()`
- `int()` ✓
- `len()`
-
- In Python, what does the following code do? ```print("Enter your age: ") age = int(input()) ```
- calculates the user's age
- prints the user's age
- asks the user for their age and stores it as an integer ✓
- asks the user for their age and stores it as a string
-
- An ______ is a numerical data type which holds a whole number that can be positive, negative, or zero.
- 'integer' ✓
- Arrange the following steps in the correct order to calculate the result of this Python expression: ```result = 2 + 4 * 6```
- 1⇔calculate the multiplication
- 2⇔calculate the addition
- 3⇔assign the value to variable result
Worksheet
Loading worksheet ...
Presentation
Loading presentation ...
Video
Lesson Details
Key learning points
- Variables are used to store and reference values.
- An assignment is an instruction that can set a variable with a provided value.
- Arithmetic expressions can be used to calculate values.
- The result of an expression can be used for assignment.
- Numerical inputs need to be converted to numbers when they are used in expressions.
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.
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.
+