What does this code print?
X = 5
print(x + 2)
7
For i in range (3):
print(“Hello”)
3 times
X = 7
If x > 5:
print(“yes”)
Else:
print(“no”)
yes
What is missing?
If X = 5:
print(“Hi”)
It uses = instead of ==
What is a variable ?
A variable stores information
X = 10
X = x - 3
print (x)
7
For i in range (1, 5):
print(I)
1,2,3,4
X = 4
If x % 2 == 0:
print(“even”)
Else:
print(“odd”)
even
For i in range (5)
print(I)
The colon is missing
What does a loop do?
It runs the same code multiple times.
X = 4
Y = x * 2
X = y - 3
print(x)
5
X = 0
While x < 4:
print(“Hello”)
x+= 1
4 times
score= 85
If score>= 90:
print(“A”)
Elif score>= 80:
print(“B”)
Else:
print(“C”)
B
X = 10
While x > 0:
print(X)
X-=1
The code inside loop is not indented
What is the purpose of an if statement ?
To make decisions in code