Passing Function as an Argument in Python

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

#Function as an Argument

# def display(f):
#     print("This is a function: " , f)
# Calling
#display(25.36)
# print(type(display))
# # print(type("Hello"))
# # print(type(125))
# # print(type(125.66))
# # print(type(True))
#-----------------------------------------------
def display(f):
    return ("Python ", f) 

def msg():
    return " is a simple language "

#Calling
print(display(msg())) # function as an argument

 

If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *