for Loop in Python — a practical guide to Python for loop with clear examples you can reuse in real projects.
Python Tutorial Series (16/95). Prefer one article? Read the complete Python tutorial.
Short description
`for item in iterable` is the most common Python loop style. Use `range()` for numeric sequences.
for examples
for n in range(1, 4):
print(n)
for ch in 'hi':
print(ch)
for name in ['Asha', 'Ravi']:
print(name)