def iter(x, f, lim=10): for _ in range(lim): yield x x = f(x) print(list(iter(1, lambda x: (2 * x) % 99)))print([(n := (lambda x: (2 * x) % 99)(n)) if i else (n := 1) for i in range(10)])
Standard input is empty
[1, 2, 4, 8, 16, 32, 64, 29, 58, 17] [1, 2, 4, 8, 16, 32, 64, 29, 58, 17]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!