By making fact a global variable, it retains the last value returned from the function each time an FCC test is ran. Since the tests are ran consecutively, it does not start with a value of 1 each time. The value of fact will always start with the value it ended with during the last test. This is a great example of why you should avoid global variables.
See what happens if you move fact inside your function.
I hadn’t even thought of that, problem is solved
Thanks for the help