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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:00, destinysmithds7790
Suppose you have 9 coins and one of them is heavier than others. other 8 coins weight equally. you are also given a balance. develop and algorithm to determine the heavy coin using only two measurements with the of the balance. clearly write your algorithm in the form of a pseudocode using the similar notation that we have used in the class to represent sorting algorithms
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, daelinrobinson
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, teamroper35
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, gymnast8900
Me if you do then you get 10 points and brainliest
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 in other subjects:

Konu
World Languages, 16.12.2020 01:00
Konu
Chemistry, 16.12.2020 01:00