0

Functions

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)) Result: >>> 30 >>> Guys can you explain me please how does this exercise work? I cannot understand it at all. What is the role of argument "func"? And how does the second return work. how do we get 30? Somebody explain me please!

14th Apr 2019, 1:00 PM
Milky Star
Milky Star - avatar
2 Antworten