Skip to content

Instantly share code, notes, and snippets.

@solen003
Created July 15, 2018 13:29
Show Gist options
  • Save solen003/63d1b011614329e748768c99be614be2 to your computer and use it in GitHub Desktop.
Save solen003/63d1b011614329e748768c99be614be2 to your computer and use it in GitHub Desktop.
Write a program which can compute the factorial of a given numbers. The results should be printed in a comma-separated sequence on a single line.
#Write a program which can compute the factorial of a given numbers.
#The results should be printed in a comma-separated sequence on a single line.
def factorial(n):
value = 1
for i in range(1, n+1):
value = value * i
return value
number = int(input("Type a number: "))
print(factorial(number))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment