+ 1
Want some explanation
I'm asking again as my first question was mistyped Can you please elaborate "function(function(arg))" from the given example Def applytwice(function,arg): Return function(function(arg)) Def addfive(x): Return x+5 Print(applytwice (addfive,10) Output is 20 Can you explain why it is adding 10 to 10 I'm new in py . Sorry for wrong capitalized words as autocorrect sucks . Thanks for reading
1 Respuesta
+ 1
applytwice(addfive, 10)
in applytwice,
addfive(addfive(10)) = addfive(10 + 5) = addfive(15) = 5 + 15 = 20