Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #Ask the user for a number using 'input' method. Write a program which can compute the factorial of a given number.
- def factorial(x):
- return 1 if x < 1 else x * factorial(x-1)
- n = input("provide integer number: ")
- print("factorial of given number = ", factorial(int(n)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement