Write a Python program that prints the factorial of a number. The number will be a single integer input from the user.
Example 1:
Input: 4
Output: 24
Example 2:
Input: 6
Output: 720
You can calculate the factorial of a number n as the product of all positive integers less than or equal to n. Consider using a loop.
n = int(input())
fact = 1
for i in range(1, n+1):
fact *= i
print(fact)
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.