• I can't pass the test..

Question related to mission Univocalic Factaral

 

My code is following.

deleted

It works fine on the console(e.g,n=0,1,2,3,100) but I can't pass the checkio test. Could you please give me some advice on how to correct my code?