Python Program - Find the Factorial of a Number

https‮i.www//:‬giftidea.com

here's a Python program that finds the factorial of a given number using a loop:

n = int(input("Enter a number: "))

factorial = 1
for i in range(1, n+1):
    factorial *= i

print("Factorial of", n, "is", factorial)

In this program, we first use the input() function to get a number from the user, and store it in the variable n.

We then initialize a variable called factorial to 1. We then use a for loop to iterate over all the numbers from 1 to n, and for each number i, we multiply factorial by i.

Finally, we use the print() function to print out the factorial of the number. Note that if the user enters 0, the result will be 1, since the factorial of 0 is defined to be 1.