how to compute the factorial of a number.

def factorial(n): fact = 1 for i in range(2,n+1): fact*=i; return factx=input("Enter a number :")print("The factorial of "+x+" is "+factorial(x))

NR

Related Python Mentoring answers

All answers ▸

Write a python function that takes a string as parameter and returns the character in the string with the most occurrences, along with the number of times this character occurs


Sales is real Customers is integer startmainprog input Sales input Customers if ((Sales > 500) OR ((Sales > 300) AND (Customers>9))) then output “Bonus Awarded” else output “No Bonus” end if end subroutine. Sales = 600 Customers = 9, answer:


Create a program that checks for syntactical errors in an email address.


Write a simple number guessing game, give the user 3 tries to guess a number between 1 and 10