Commit ee356fec by BellCodeEditor

auto save

parent d9d17247
Showing with 19 additions and 0 deletions
# #用递归的方式求1+2+3+4+5+6+n的和
# def sum(n):
# if n = 1:
# return 1
def sum_numbers(num):
# 递归的出口
if num == 1:
return 1
# 数字的累加
temp = sum_numbers(num - 1)
return num +temp
result = sum_numbers(3)
print(result)
\ No newline at end of file
......@@ -6,6 +6,7 @@ import random
pen = turtle.Turtle()
pen.speed(0)
pen.color('sienna')
# 画布大小
w = turtle.Screen()
......
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