!
fortnight_players = 784
wow_players = 813
if fortnight_players > 700 and wow_players > 700:
print("The competition can go ahead")
if fortnight_players > wow_players:
print("We have more Fortnight players")
else:
print("We have more WoW players")
fortnight_players = 784
wow_players = 813
if fortnight_players > 700 and wow_players > 700:
print("The competition can go ahead")
if fortnight_players > wow_players:
print("We have more Fortnight players")
else:
print("We have more WoW players")
The competition can go ahead
We have more WoW players
In pairs, discuss for three minutes what you think a loop would do in a computer programming language.
n = 0
print(n)
n = n + 1
print(n)
n = n + 1
print(n)
n = n + 1
print(n)
n = n + 1
n = 0
for i in range(0, 4):
print(n)
n = n + 1
for i in range(0, 4):
print(i)
i is a local variable that changes each time the loop repeats
4 times
5 times
6 times
for i in range(0, 5):
print(i)
3 times
4 times
9 times
12 times
for i in range(9, 12):
print(i)
10 times
15 times
30 times
for i in range(15, 30):
print(i)
for num1 in range(0, 5):
for num2 in range(0, 5):
print(num1, num2)
This will loop 25 times (5 x 5)
for num1 in range(0, 5):
for num2 in range(0, 5):
print(num1, num2)
This will loop 25 times (5 x 5)
5 times
50 times
60 times
for num1 in range(5, 10):
for num2 in range(0, 10):
print(num1, num2)
Calculate the quotient and remainder for each of the following:
7 ÷ 3
9 ÷ 7
81 ÷ 21
x = 9 / 4
y = 8 % 3
number = 7
if number % 2 == 0:
print("This is an even number")
Apply a filter: