Commit 229967df by BellCodeEditor

auto save

parent 024fb164
total = [] def func1(): #返回用户输入的价格列表
while True: total = []
unit= input("请输入:") while True:
if unit== 'q': try: #尝试用户输入是否错误
break unit = int(input("请输入:"))
else: except: #用户输入的不是整数的情况(错误的时候)
total.append(unit) print("数据输入错误")
print(total) else: #用户输入的是整数的情况(正确的情况)
\ No newline at end of file if unit == -1: #如果输入的是-1,程序结束
print("程序结束")
break
else:
total.append(unit)
return total
def sum(x): #返回 列表 x 中的数字的和
count = 0
for i in x:
count = count + i
return count
\ No newline at end of file
import turtle
def tree(n):
if n>=10:
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
pen.up()
pen.forward(n*(-1))
pen.down()
pen = turtle.Pen()
pen.up()
pen.goto(0,-200)
pen.color("red")
pen.setheading(90)
pen.down()
tree(60)
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