I have been spent 3 days on "SECOND LESSON- 2ND LESSON" and still i dont know about its functioning..plz note : only 2nd slide | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have been spent 3 days on "SECOND LESSON- 2ND LESSON" and still i dont know about its functioning..plz note : only 2nd slide

https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2437/

22nd Sep 2020, 12:43 AM
#challenger mg
#challenger mg - avatar
2 Answers
+ 5
A lot of people have trouble with this concept. # First function adds x+y. def add(x, y):     return x + y print(add(2,3)) #5 # This function sets a placeholder for another function to be emplaced within. def do_twice(func, x, y):     return func(func(x, y), func(x, y)) # The previous bit of code could be saying: return add(add(a,b), add(a,b)) Which will make return add(15, 15) Which will return 30 a = 5 b = 10 print(do_twice(add, a, b)) #30
22nd Sep 2020, 2:19 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 4
Hi #challenger mg, I believe you have asked this question before, please refrain from making duplicate Questions! Have you seen these? https://www.sololearn.com/discuss/1316935/?ref=app https://www.sololearn.com/discuss/2349030/?ref=app
22nd Sep 2020, 12:55 AM
Vachila64☕
Vachila64☕ - avatar