Declaring functions to variables in Python

Source code :

def fun1():
    print ("hai")
def fun2():
    print ("how are you?")
    
f1=fun1
f2=fun2
array=[f1,f2]
for value in array:
    value()

Output :

hai how are you?

Output :


                

Comments :