Commit d3988dd2 by BellCodeEditor

save project

parent 3ccf12a0
Showing with 23 additions and 10 deletions
#定义一个函数SB() import turtle
#要求这个函数能接收一个名为SB的整型参数 pen=turtle.Turtle()
def func(n): pen.color('sienna')
if n<=2: w=turtle.Screen()
return 1 w.bgcolor('wheat')
elif n>2: pen.left(90)
SB=func(n-2)+func(n-1) pen.up()
return SB pen.backward(150)
print(func(8)) pen.down()
\ No newline at end of file def tree(n):
if n>=50:
pen.fd(n)
pen.right(30)
tree(n-1)
pen.left(60)
tree(n-1)
pen.right(30)
pen.up()
pen.backward(n)
pen.down()
tree(100)
turtle.done()
\ 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