+ 2
question about function?
How to solve this? def fun (x): if x == 1: return 1 else: return x * fun (x-1) print (fun(5))
2 ответов
+ 2
Asma Al-Samman when x==5, fun=5*fun(4)=5*4*fun(3)=5*4*3*fun(2)=5*4*3*2*1=120
+ 3
Calling such a case a recursive function, I recommend you read about it and then I'm sure you can answer the question yourself