Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4 # Given a number, this function will compute the factorial # For example 4! = 1 x 2 x 3 x 4 =

Question 4

# Given a number, this function will compute the factorial

# For example 4! = 1 x 2 x 3 x 4 = 24. Note that the value of 0! is 1.

def get_factorial(number):

"""

what it takes?

number to calculate its factorial

what it does?

given a number, find its factorial such as 5! = 20

Do not use a python built-in function - code it

what it returns?

factorial of a number

5! shoukld return 120

It will return integer

"""

# your code goes in here

Test case for question 4

try:

if get_factorial(5) == 120:

score['question 4'] = 'pass'

else:

score['question 4'] = 'fail'

except:

score['question 4'] = 'fail'

get_factorial(5)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions