You wrote a program to find the factorial of a number. In mathematics, the factorial operation is used for positive integers and zero.
What does the function return if the user enters a negative three?
def factorial(number):
product = 1
while number > 0:
product = product * number
number = number - 1
return product
strNum = input("Enter a positive integer: ")
num = int(strNum)
print(factorial(num))
-6
1
There is no output due to a runtime error.
-3