Commit 40d82566 by BellCodeEditor

save project

parent 65c8a916
Showing with 3 additions and 2 deletions
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#要求这个函数能计算1+2+3+……+num的结果 #要求这个函数能计算1+2+3+……+num的结果
def s(x): def s(x):
if x==1: if x<3:
return 1 return 1
return s(x-1)+x return s(x-1)+s(x-2)
num=10 num=10
print(s(num)) print(s(num))
\ 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