200k views
3 votes
Complete the function to return the factorial of the parameter,

def factorial(number):
product = 1
while number
product = product number
number
return product
strNum = input("Enter a positive integer:)
num = int(strNum)
print(factorial(num))

User Pycm
by
7.2k points

2 Answers

1 vote

Answer:

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))

Step-by-step explanation:

i got it right on edge 2020

User Andrew Paramoshkin
by
7.0k points
6 votes

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))

I hope this helps!

User Aarbelle
by
7.0k points