def foo(value): while True: value = (yield value) bar = foo(1)print(next(bar))print(next(bar))print(bar.send(2))
Standard input is empty
1 None 2
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!