x = 5
y = x + 2
print(y)
7
for i in range(3):
print(i)
0
1
2x = 10
if x > 5:
print("High")
else:
print("Low")
High
print("Hello)
Closing quotation mark is missing
What is a variable??
A variable stores data that can be used and changed in a program
num = 3
num = num * 2
num = num + 4
print(num)
10
total = 0
for i in range(1, 4):
total += i
print(total)
6
num = 7
if num % 2 == 0:
print("Even")
else:
print("Odd")
Odd
for i in range(5)
print(i)
Colon is missing after for statement
What does a loop do in a program??
A loop repeats a block of code multiple times
a = 4
b = a
a = a + 3
print(b)
4
total = 0
for i in range(2, 10, 2):
total += i
print(total)
20
score = 85
if score >= 90:
print("A")
elif score >= 80:
print("B")
else:
print("C")
B
num = "5"
print(num + 2)
Mixing string with an integer
What’s the difference between = and == in python??
= assigns a value, while == checks if two values are equal