0

What is the meaning of func in this code?

def add(x, y): return x + y def do_twice(func, x, y): return func(func(x, y), func(x, y)) a = 5 b = 10 print(do_twice(add, a, b))

18th Jul 2018, 12:32 PM
ADITYA SINHA
ADITYA SINHA - avatar
3 Respostas
+ 3
Sorry Aditya. I did not understand what you meant. Could you explain?
18th Jul 2018, 1:39 PM
cyk
cyk - avatar
+ 2
func in this case is just a name to given to the parameter. They could have used any other name like sololearn, aditya or whatever. Here they chose the expression func because the argument that will be passed there is a function
18th Jul 2018, 12:46 PM
cyk
cyk - avatar
+ 1
What is 2 func in this code?
18th Jul 2018, 1:30 PM
ADITYA SINHA
ADITYA SINHA - avatar