Fibonacci Sequence
Medium · 50 XPPrint the first 10 Fibonacci numbers (starting 0, 1) on one line separated by spaces.
Target output
0 1 1 2 3 5 8 13 21 34
Blank · autosaved
PYfibonacci.py
Track a, b = 0, 1; append to a list; print(" ".join(map(str, fibs))).
fibs = []
a, b = 0, 1
for _ in range(10):
fibs.append(a)
a, b = b, a + b
print(" ".join(map(str, fibs)))
Run your code to check it…