Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def factorial(num):
- if num < 0:
- print("Sorry, factorial does not exist for negative numbers")
- if num == 0:
- return 1
- return num * factorial(num-1)
- if __name__ == "__main__":
- num = 1
- print(factorial(num))
Add Comment
Please, Sign In to add comment