The factorial of a positive integer n is the product of the first n positive
integers.
Write a function named factorial that accepts an integer n as argument.
n if n is a positive integer.-1 if n is a negative integer.1 if n is zero.You do not have to accept input from the user or print anything to the console. You just have to write the function definition.
Example
factorial(5) -> 120
factorial(0) -> 1
factorial(-3) -> -1
Implement this function:
def factorial(n):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: n.
Input
5
Output
120