There are a couple of things you need to fix in your code.
First, I think perhaps you’ve misunderstood how to calculate a factorial.
We can calculate the factorial (
n!) of any non-negative integer
n by multiplying it by every positive integer that is less than
5! = 5 x 4 x 3 x 2 x 1 = 120
You can’t calculate the factorial of a negative integer.
Second, the response you’re getting from the Codecademy editor of
Kill signal (SIGKILL) suggests that you have an infinite loop.
while loop will continue to run so long as the condition you’ve given it remains true. So, the following loop will never end:
print "I am a never ending while loop!"
In your code, the
while loop will continue to run so long as
x != 0. Are you sure that’s the correct condition for your