To find factorial in python

how did no=10 ans=1 for i in range(1,11):
ans *= i give the factorial ?

Initially value in ans=1
Due to for loop I will take value 1,2,3,4,5,6,7,8,9 and 10 .
So initially the value of I will also be 1 and it will keep on increasing .
So for the first iteration ans = ans1 = 11 =1
For second iteration i will become 2 ,so ans=ans2 =12=2
Now the value of ans=2
For the next iteration i=3 , so ans= ans3=23 =6
Now ans=6
For next iteration i=4 , ans= 6*4= 24
This will keep on occuring till i become 10

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.