I am a fairly new python student, so please excuse any errors.
I am having trouble coming up with the correct output for this sketch i got from a friend. Could you please point out what's wrong and how to correct it?
For example, if i enter Factorial(16), i get 16 as the output.
But if i enter Factorial(4) i get 7 as the output.
This is the sketch:
I am having trouble coming up with the correct output for this sketch i got from a friend. Could you please point out what's wrong and how to correct it?
For example, if i enter Factorial(16), i get 16 as the output.
But if i enter Factorial(4) i get 7 as the output.
This is the sketch:
n=7 def factorial(n): if n<0: n*=-1 if (n==0): return 0 f= 1 while n>1: f*=n n-=1 return f