subject

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:50
What is a rush associated with alcohol?
Answers: 1
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
You know the right answer?
You wrote a program to find the factorial of a number. In mathematics, the factorial operation is us...
Questions
question
Mathematics, 03.06.2021 01:10
question
Spanish, 03.06.2021 01:10
question
Mathematics, 03.06.2021 01:10
question
Mathematics, 03.06.2021 01:10
Questions on the website: 13722367