Commit 7c25cfae by BellCodeEditor

auto save

parent ed98e649
Showing with 9 additions and 4 deletions
......@@ -8,12 +8,10 @@
num + func(num-1);当num等于1的时候,func(1)返回值为1
'''
def func(num):
if num == 1:
return 1
value = num + func(num-1)
value = num * func(num - 1)
return value
print(func(10))
print(func(999))
def f(n):
if n == 1:
return 1
value = n *f(n-1)
return value
print(f(6))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment