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/
2 odpowiedzi
+ 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
+ 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