MENU
Question -

Create a function factorial(x) that takes an integer and returns the product of all the positive integers less than or equal to n.



Answer -

def factorial(num):
product =1
i = num
while i > 0:
product *=i
i-=l
return product

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×