how to pass function as paraemter of another function pythpn
def add(a, b):
return a + b
def mul(a, b):
return a * b
def calculate(a, b, func): #calculate is higher order function
return func(a, b)
print(calculate(2, 3, mul))
how to pass function as paraemter of another function pythpn
def add(a, b):
return a + b
def mul(a, b):
return a * b
def calculate(a, b, func): #calculate is higher order function
return func(a, b)
print(calculate(2, 3, mul))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us