Commit d3988dd2 by BellCodeEditor

save project

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