We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bccf15 commit 4a5cb73Copy full SHA for 4a5cb73
1 file changed
factorial.py
@@ -0,0 +1,8 @@
1
+def factorial(n):
2
+
3
+ # single line to find factorial
4
+ return 1 if (n==1 or n==0) else n * factorial(n - 1)
5
6
+num = int(input("Enter a number: "))
7
+print ("Factorial of",num,"is",
8
+ factorial(num))
0 commit comments