+ 1
How this code works?
If I input 0 to this fact function . The answer is 1. But why the for loop is not working for this ? Explain. https://code.sololearn.com/c9LQlk13lc69/?ref=app
3 Réponses
+ 2
When n is 0, it will be range(1, 1).
The start and the end is the same and thus the loop doesn't run.
+ 3
I don't understand your question.
You don't need the 'if' statement, just a single 'fact = 1', i.e. delete lines 2 and 3.
The for loop is working. In the case of n = 0, it runs from 1 to 1.
+ 1
Thanks friends.