Welcome to Chapter 3: Control Flow! 🎯
💡 Think of it like this: Control flow is like a choose-your-own-adventure book. Based on a condition, your program takes different paths!
Python uses the random module to generate random numbers — perfect for simulating a coin flip! 🪙
How if/else works:
if checks a condition — is it True or False?ifelse and run that code instead: after if and else!import random
# random.randint(a, b) gives a random number from a to b
coin = random.randint(0, 1)
if coin == 0:
print('Heads!')
else:
print('Tails!')