SHARE
TWEET

Untitled

a guest Apr 24th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. #Ask the user for a number using 'input' method. Write a program which can compute the factorial of a given number.
  3.  
  4. def factorial(x):
  5.     return 1 if x < 1 else x * factorial(x-1)
  6.  
  7. n = input("provide integer number: ")
  8. print("factorial of given number = ", factorial(int(n)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top