What is Control Flow?
By default, Python executes code line by line from top to bottom. Control flow structures allow you to change this order — making your program skip certain lines, repeat others, or choose between different paths based on conditions.

Control Flow Structures in Python
The if Statement
# Basic if statement score = 75 if score >= 50: print("You passed!")
The if-elif-else Statement
temperature = 35 if temperature > 40: print("It is extremely hot!") elif temperature > 30: print("It is hot.") elif temperature > 20: print("It is warm.") else: print("It is cool.")

Python uses indentation (4 spaces) to define code blocks inside control flow structures. Every line inside an if, elif, or else block must be indented consistently.

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)