0

What does this code do? return func(func(x, y), func(x, y))

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)) ----------------------------------------------------- In the above piece of code, I'd like to know what does this code: ============================ return func(func(x, y), func(x, y)) ============================ do?

2nd Sep 2020, 7:21 AM
Daniel Chettiar
Daniel Chettiar - avatar
1 Antwort
+ 1
This code has the task to multiply by 2 the return value of a fuction.add function will added 10 and 5 then then add the result by itself ==> result+result
2nd Sep 2020, 11:01 AM
HBhZ_C
HBhZ_C - avatar