From d7d3c3f9bf9a9158c438438c9e90f4c5b4a9e846 Mon Sep 17 00:00:00 2001 From: Pratik Thorat <66405786+thorat-pratik@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:18:51 +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))