You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
answer=1# We start with 1 as usual for finding factorial
3
+
4
+
foriinrange(1, (number+1)): # 1 is added to second argument of range function since it in this syntax loop terminates at the second value without executing for that value.
5
+
answer=answer*i
6
+
7
+
returnanswer# answer now contains the calculated value
8
+
9
+
10
+
11
+
if__name__=='__main__':
12
+
number=input("Enter the number : ")
13
+
number=int(number)
14
+
factorial=get_factorial(number)
15
+
print ("The factorial of "+number+" is = "+factorial)
0 commit comments