how does a list of functions work in python?

I have modified the code so it will be easy to understand.
The 2 functions are called and print what they print.
Each function return None so the list is populated with 2 None values

def function0():
    print("0")
    return None


def function1():
    print("1")
    return None


lst = [function0(), function1()]
print('-------------------')
for i in range(2):
    print(lst[i])

output

0
1
-------------------
None
None

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top