Loops · Python example
Generate the first n Fibonacci numbers with parallel assignment.
Each Fibonacci number is the sum of the two before it. Python's tuple assignment updates both variables in one step.
count = 10
a, b = 0, 1
for _ in range(count):
print(a, end=" ")
a, b = b, a + b
print()