Change list while looping: endless list
numbers = [1, 1]
for n in numbers:
print(n)
numbers.append(numbers[-1] + numbers[-2])
if n > 100:
break
print(numbers)
Creating a Fibonacci series in a crazy way.
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
numbers = [1, 1]
for n in numbers:
print(n)
numbers.append(numbers[-1] + numbers[-2])
if n > 100:
break
print(numbers)
Creating a Fibonacci series in a crazy way.