fork download
  1. def iter(x, f, lim=10):
  2. for _ in range(lim):
  3. yield x
  4. x = f(x)
  5.  
  6. print(list(iter(1, lambda x: (2 * x) % 99)))
  7. print([(n := (lambda x: (2 * x) % 99)(n)) if i else (n := 1) for i in range(10)])
Success #stdin #stdout 0.13s 14180KB
stdin
Standard input is empty
stdout
[1, 2, 4, 8, 16, 32, 64, 29, 58, 17]
[1, 2, 4, 8, 16, 32, 64, 29, 58, 17]