Home »
Python »
Python Programs
Python program to pass function as an argument
Here, we are going to learn how to pass function as an argument in Python?
By Shivang Yadav Last updated : January 05, 2024
Python allows programmers to pass functions as arguments to another function.
Such functions that can accept other functions as argument are known as higher-order functions.
Program to pass function as an argument
# Function - foo()
def foo():
print("I am Foo")
# higher-order function -
# koo() accepting foo as parameter
def koo(x):
x()
# function call with other function
# passed as argument
koo(foo)
Output
The output of the above program is:
I am Foo
To understand the above program, you should have the basic knowledge of the following Python topics:
Python Basic Programs »