diff --git a/100+ Python challenging programming exercises for Python 3.md b/100+ Python challenging programming exercises for Python 3.md index c4ba62c4..73d67674 100644 --- a/100+ Python challenging programming exercises for Python 3.md +++ b/100+ Python challenging programming exercises for Python 3.md @@ -66,6 +66,17 @@ def fact(x): x=int(input()) print(fact(x)) ``` +#second method + +def factorial(n): + fact=1 + while n >= 1: + fact=fact*n + n=n-1 + return fact +x=int(input("enter number")) +factorial(x) + ### Question 3 Level 1