trace the code
loop logic
if/else reasoning
debug the idea
vocabulary and concepts
100

What will be the output of the following code?

x = 5

y = 10

print(x + y)


15

100

how many times will the following loop print hello?

for i in range(4):

    print("Hello")


4 times

100

what will this code output?

x = 5

if x > 3:

    print("Greater")

else:

    print("Smaller")


greater

100

why does this code cause a error?

print(total)

total = 5


total is used before it is defined.

100

what is a variable?


A named location that stores data.

200

what is the output of this code snippet?

for i in range(3):

    print(i * 2)


0,2,4

200

what is the output of this code?

x = 0

while x < 3:

    print(x)

    x += 1


0,1,2

200

what is the code of the following code?

age = 17

if age >= 18:

    print("Adult")

elif age >= 13:

    print("Teenager")

else:

    print("Child")


teenager

200

what is the logical mistake?

for i in range(5):

print(i)


The print(i) line is not indented.

200

What is the difference between = and ==?

= assigns a value, while == compares values.

300

what will this code output?

x = 2

y = 3

if x == y:

    print("Equal")

else:

    print("Not Equal")


not equal

300

what will be the output of this code?

sum = 0

for i in range(1, 5):

    if i % 2 == 0:

        sum += i

print(sum)


6

300

what will be printed by this code?

x = -5

if x > 0:

    print("Positive")

elif x < 0:

    print("Negative")

else:

    print("Zero")


negative

300

why does this loop never end ?

x = 1

while x < 5:

    print(x)


x is never updated

300

What does “loop condition” mean?

The expression that determines whether a loop continues running.

M
e
n
u