Question

Question 6 of 19 Python The factorial of a positive integer n, fact(n), is defined recursively...

Question 6 of 19 Python

The factorial of a positive integer n, fact(n), is defined recursively as follows:

fact(n) 51, when n51

fact(n) 5n * fact(n21), otherwise

Define a recursive function fact that returns the factorial of a given positive integer.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey here is answer to your question.

In case of any doubt comment below. Please UPVOTE if you Liked the answer.

def fact(n):
   if n == 1 or n==0:
       return 1
   else :
       return n*fact(n-1)

print(fact(3))
print(fact(4))
print(fact(5))
print(fact(6))

Add a comment
Know the answer?
Add Answer to:
Question 6 of 19 Python The factorial of a positive integer n, fact(n), is defined recursively...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT