Loops
Python loops are clean and readable. The `for` loop works great with lists and ranges.
# For loop
for i in range(5):
print(i) # 0, 1, 2, 3, 4
# Loop through a list
fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print(fruit)
# While loop
count = 0
while count < 5:
print(count)
count += 1
# List comprehension (powerful shortcut)
squares = [x ** 2 for x in range(10)]