Aug-04-2019, 08:39 AM
Hi,
I'm trying out the code below but need help in understanding why the
it's printing 3 3 3 rather than 1 2 3.
I'm trying out the code below but need help in understanding why the
it's printing 3 3 3 rather than 1 2 3.
list_of_printers = [] for i in [1, 2, 3]: def printer(): print(i) list_of_printers.append(printer) for func in list_of_printers: func()Thanks in advance for any help.