Program Structure and Control Flow
Loops and Iterations
Throw-away Variable
s = [(1, 2, 3), (4, 5, 6)]
for x, _, z in s:
print(x, z)Wildcard Unpacking
s = [(1, 2), (3, 4, 5), (6, 7, 8, 9)]
for x, y, *extra in s:
print(f"{x = }", f"{y = }", f"{extra = }")
Enumerate

for-else Loop
for-else LoopIterators
Last updated