x = 5
print(x
5
for i in range(3):
print(i)
0, 1, 2
x = 5
if x > 3:
print("Yes")
else:
print("No")
yes
print("Hello)
Missing quote
What is a variable?
It stores data.
x = 3
x = x + 2
print(x)
5
for i in range(1, 5):
print(i)
4
x = 2
if x == 5:
print("Yes")
else:
print("No")
No
if x = 5:
print("Yes")
Wrong operator
What does a loop do?
Repeats code
x = 10
y = 20
x = y
y = x - 5
print(x)
20
x = 0
for i in range(5):
x += i
print(x)
10
x = 10
if x < 5:
print("Low")
elif x < 15:
print("Medium")
else:
print("High")
Medium
for i in range(5)
print(i)
Missing colon
What is an if statement?
A decision
x = 2
y = x + 4
print(y)
6
for i in range(2, 6):
print(i)
4
x = 7
if x > 10:
print("Big")
else:
print("Small")
Small
x = 3
if x == 3:
print("Yes")
Wrong indentation
What does range(5) do?
Gives numbers 0 to 4
x = 5
y = 3
x = x - y
print(x)
2
x = 0
for i in range(3):
x = x + 2
print(x)
6
x = 4
if x == 3:
print("A")
elif x == 4:
print("B")
else:
print("C")
B
for i in range 5:
print(i)
Range needs parentheses
What does += mean?
Add and store