+ 4
How is this posible?
def func(num): g = (lambda x:1 if x==1 else x*g(x-1)) return g(num) print(func(4)) Output --> 24
3 Antworten
+ 1
First value of x is 4
In first step : the else statement will execute 4*g(3)
In second step : the else statement will execute too
4*3*g(2)
In third step: which happen in first and second will happen here too
4*3*2*g(1)
Last step: the if statement will execute and return 4*3*2*1 which equal 24
Brian Lazo
+ 4
Thanks MuhammadⓂ️🥇🛡️✔️ !! You are awesome ! I'm very grateful to You
+ 2
you're welcome💝💚💞🌸🌹😊
BALRV 🚭