0
Can anyone tell where my code is wrong, this code runs 2 test cases , I was stuck the remaining test cases. Can anyone send code
This is the my code def fact(n): if(n>0 and n<3): return 1 return fact(n-fact(n-1))+fact(n-fact(n-2)) n=int(input()) print(fact(n))
2 Respostas
+ 2
Your function returns 1 if 2 is input but should be 2. It should return 1 only if the input is 1 or 0.
This is assuming that "fact" is short for "factorial" and that is what you are trying to code. If not, then you'll need to mention the problem description.
0
I was normally used fact function, this is not factorial programming ...