196k views
2 votes
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

User Nickel
by
7.3k points

2 Answers

6 votes

Answer: 1

Step-by-step explanation:

got it on Edge.

User Nfvs
by
8.6k points
5 votes

Answer:

The correct answer is 1

Step-by-step explanation:

Correct on edge 2020

You wrote a program to find the factorial of a number. In mathematics, the factorial-example-1
User Barrack
by
8.7k points