Why isn't my code correct?

Why isn't my code correct?
0.0 0

#1

Here’s a picture of my code. The result is 120 so im not sure why it isnt accepting it.

41 PM


#2

You haven’t provided any context for this, but I’m going to guess that it’s because you’re using a global variable.


#3

Since you place var result outside the function (and you don’t clear it everytime you run the function) its value will keep increasing. So, only the first run will be correct, but the tests will run your code several times.


#4

Thank you! And yeah my bad for not providing any context, I am working on the factorialize algorithm exercise.