From 6a2bd19e40e0a38a53877510f1c3f3dcabc87c14 Mon Sep 17 00:00:00 2001 From: Pratik Thorat <66405786+thorat-pratik@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:24:03 +0530 Subject: [PATCH] Create Factorial.py Added Python program for factorial --- Python/Factorial.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Python/Factorial.py diff --git a/Python/Factorial.py b/Python/Factorial.py new file mode 100644 index 00000000..0082eaeb --- /dev/null +++ b/Python/Factorial.py @@ -0,0 +1,10 @@ +# Python 3 program to find +# factorial of given number +def factorial(n): + + # single line to find factorial + return 1 if (n==1 or n==0) else n * factorial(n - 1) + +# Driver Code +num = 5 +print("Factorial of",num,"is",factorial(num))