def multipliers(): return [lambda x: i * x for i in range(4)] print [m(2) for m in multipliers()]
Standard input is empty
[6, 6, 6, 6]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!