```html GCSE Python Practice – Exam Style

GCSE Python Practice – Exam Style Questions

White background, black text. Type your answer, then press Check for each question.

1.

Consider the following Python code:

x = 3
y = 4
z = x + y * 2
print(z)
    

What is the output?

2.

What is the final value of total after this code runs?

total = 0
for i in range(1, 5):
    total = total + i
    
3.

Complete the condition so that the message is printed only when age is between 13 and 18 inclusive.

age = int(input("Enter age: "))
if ____________________:
    print("Teenager")
    

Write the full condition to go inside the if (e.g. age > 0).

4.

What is printed by this code?

nums = [2, 4, 6]
nums.append(8)
nums.pop(0)
print(nums)
    
5.

What is the data type of the variable value after this line?

value = input("Enter a number: ")
    
6.

Write a Boolean expression that is True only when score is between 0 and 100 inclusive.

Use score in your answer.

7.

What does this function return when called as mystery(5)?

def mystery(n):
    result = 1
    for i in range(1, n + 1):
        result = result * 2
    return result
    
8.

What is the final value of x after this code runs?

x = 10
while x > 3:
    x = x - 2
    
9.

A program runs without crashing, but the answer it prints is wrong because the formula is incorrect.

What type of error is this? (syntax, logic, or runtime)

10.

Give one reason why a Python program might use functions (subprograms) instead of writing all the code in one long block.

```