Reference library
Python code samples
Easy snippets you can copy, study, and run in the browser editor.
Sponsored
Reserved space — layout preview until AdSense is connected
Lists & loops
easy
Enumerate with index
Loop with both index and value — cleaner than manual counters.
loops
enumerate
lists
Python
tasks = ["read docs", "write code", "run tests"]
for i, task in enumerate(tasks, start=1):
print(f"{i}. {task}")
5
0
Open
Lists & loops
easy
Zip two lists
Pair items from parallel lists and iterate them together.
lists
zip
loops
Python
names = ["Ada", "Grace", "Katherine"]
scores = [98, 95, 100]
for name, score in zip(names, scores):
print(f"{name}: {score}")
print(list(zip(names, scores)))
3
0
Open
Browse by section
Each section groups closely related Python snippets.