From f1c18dfb226e580c98e60d33321887b61d396c88 Mon Sep 17 00:00:00 2001 From: Himanshu Porwal <56030087+himanshu-17@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:11:38 +0530 Subject: [PATCH] Create 3hp.py --- 3hp.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 3hp.py diff --git a/3hp.py b/3hp.py new file mode 100644 index 0000000..52f0a01 --- /dev/null +++ b/3hp.py @@ -0,0 +1,13 @@ +# 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)) + +# This code is contributed by Smitha Dinesh Semwal