0
Functions as a object
Could someone explain this code? how its work def add(x, y): return x + y def do_twice(func, x, y): return func(func(x, y), func(x, y)) a = 5 b = 10 print(do_twice(add, a, b))
1 Resposta
0
do_twice(add,5,10)
=> add( add(5,10) , add(5,10) )
=> add( 5+10 , 5+10 )
=> add( 15 , 15 )
=> 15+15
=> 30