Does my explanation make sense? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does my explanation make sense?

""" def add(x, y): return x + y #if anything was added as print (5,10) the answer would be normal as 15 def do_twice(func, x, y): return func(func(x, y), func(x, y)) #what is func? it is a third argument. Isn't supoose to be add(x,y) instead of func? a = 5 b = 10 print(do_twice(add, a, b)) #here add= the first function which return 15 then the do_twice function should do something?! """

30th Apr 2018, 1:17 AM
Medo Hamdani
Medo Hamdani - avatar
1 Answer
+ 3
Here. Look at the comments. I have reworded them a bit to help you. https://code.sololearn.com/cwK3LjWYsq8b/?ref=app
30th Apr 2018, 2:23 AM
cyk
cyk - avatar