Passing function as function's parameter in Python

Passing function as function's parameter in Python

Instructor-svgAl-Mamun Sarkar
Mar 26 , 2020

Passing function as function's parameter in Python. The following code shows how to pass a function as a function's parameter in the Python programming language.

def get_int_as_str(number):
    return str(number)


def print_int(my_function, number):
    print(my_function(number))
    return


print_int(get_int_as_str, 130)

 

Output:

130

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram