Write a Python program that uses the math module to find the factorial of a user input number. Return the factorial.
Example 1:
Input: 5
Output: 120
Example 2:
Input: 7
Output: 5040
Use the factorial() function from the math module.
import math
def factorial(num):
return math.factorial(num)
# Test the function
print(factorial(5)) # Output: 120
print(factorial(7)) # Output: 5040
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.