Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
Here's what is happening on the last line ((5 + 10) + (5 + 10)) I think the easiest way to understand it is to replace the function's variable names with the names you're giving it as input add(add(5, 10), add(5, 10)) I think you want do_twice to look like this def do_twice(func, x, y): return func(x, y) + func(x, y) You could also have the return be return 2 * func(x, y)
30th Jul 2016, 12:59 PM
Spencer
Spencer - avatar