Commit fcec1edf by BellCodeEditor

auto save

parent d656113f
Showing with 1 additions and 9 deletions
# 1、定义一个递归函数,函数名自取;
# 1、定义一个递归函数,函数名自取;
......@@ -4,10 +4,3 @@
# 如果定义的函数为func(num),那么func(num)=num + func(num-1);
# 当num等于1的时候,func(1)返回值为1
def sum_number(num):
if num==1:
return 1
p=sum_number(num-1)
return num+p
result=sum_number(100)
print(result)
\ 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