code for chapter 3
This commit is contained in:
7
03_recursion/python/03_factorial.py
Normal file
7
03_recursion/python/03_factorial.py
Normal file
@@ -0,0 +1,7 @@
|
||||
def fact(x):
|
||||
if x == 1:
|
||||
return 1
|
||||
else:
|
||||
return x * fact(x-1)
|
||||
|
||||
print fact(5)
|
||||
Reference in New Issue
Block a user