Python function to calculate the factorial of a number. The function accepts he number as an argument.
Code:
def fact(num):
factorial = 1;
for i in range(1, num+1):
factorial = factorial * i
print("Factorial
of", i, "is:", factorial)
x = int(input("Enter a number: "))
fact(x)
Comments
Post a Comment