Change list while looping: endless list
examples/advanced/endless_for.py
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.
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.