Control Flow
Learn to control program flow with conditionals and loops.
If Statements
age = 18
if age >= 18:
print("Adult")
elif age >= 13:
print("Teenager")
else:
print("Child")
For Loops
# Loop through a list
fruits = ["apple", "banana", "orange"]
for fruit in fruits:
print(fruit)
# Range function
for i in range(5):
print(i)
While Loops
count = 0
while count < 5:
print(count)
count += 1