Trace the code
Loop logic
If / else reasoning
Debug the idea
Vocabulary & Concepts
100

What is printed by the following code? 

x = 3

x = x + 2

print(x)


5

100

Why does an if statement allow a computer to make a decision?


Because it checks a condition and chooses between two outcomes.


100

What is printed by the following code?

num = 4

if num > 0:

    print("Positive")

else:

    print("Negative")


Positive

100

What is wrong with the code?

if age = 16:

    print("Can drive")


The assignment operator = is used instead of ==.

100

What is a string?

Text data written inside quotation marks.

200

What is printed?

x = 10

y = x - 4

x = y + 1

print(x)


7

200

What happens if multiple if statements are used instead of if / elif?


More than one condition could run.


200

What is printed 🥺👀

x = 10

if x < 5:

    print("A")

elif x < 15:

    print("B")

else:

    print("C")

B

200

What is wrong with the code below?

print("Hello world)

The closing quotation mark is missing.

200

Why do we use int() with input?

To convert the input from a string into a number.

300

What is printed? 

a = 5

b = a

a = a + 3

print(b)


5

300

Why is elif better than multiple else if ideas?


It checks conditions in order and stops once one is true.


300

What is printed

x = 8

if x % 2 == 0:

    if x > 10:

        print("Big Even")

    else:

        print("Small Even")

else:

    print("Odd")

Small even

300

What is wrong in the following code?

Age = input("How old are you?")

if age >= 16:

    print("You can drive")


The variable name does not match (Age vs age).

300

What is a logic error?

When the code runs but produces the wrong result.