Program - print the numbers properly by creating a list


Topic: Program - print the numbers properly by creating a list

Solution

my_list = [lambda x=i: x for i in range(5)]
for l in my_list:
    print(l())



List all Python Programs