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))
3 Antworten
+ 3
Sorry Aditya. I did not understand what you meant. Could you explain?
+ 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
+ 1
What is 2 func in this code?