Syntax:
if <condition>:
<code inside the if statement>
Example:
value = 100
if value < 100:
print('smaller than 100')
More examples: https://www.w3schools.com/python/python_conditions.asp
Syntax:
for <variable> in <collection>:
<code inside the for loop>
Example 1 (executing something n times):
for i in range(n):
print(n)
Example 2:
my_list = [10, 23, 45, 10, 7]
for i in my_list:
result = i * 3
print(result)
More examples: https://www.w3schools.com/python/python_for_loops.asp
Syntax:
while <collection>:
<code inside the while loop>
Example 1 (executing something forever):
import random
while True:
random_number = random.random()
print(random_number)