Commit 6512e816 by BellCodeEditor

auto save

parent 05e7d622
def new_input():
total = []
while True:
unit = input('请输入(q退出):')
if unit == 'q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
finally:
print("=====================")
return total
def sum(money):
count = 0
for i in money:
count = count + i
return count
price = new_input()
pay = sum(price)
#print("您一共消费了" + str(pay) + "元!扫码还是现金呢?")
\ No newline at end of file
import func
# 调用自定义的输入函数,实现分数输入的功能
data = func.new_input()
# 调用自定义的求和函数,计算需要支付的总价
score = func.sum(data)
print("这位选手的总分数为:"+str(score))
\ No newline at end of file
import turtle #导包
import turtle #导包
turtle.color("black","black")
turtle.begin_fill()
turtle.circle(50,180)
turtle.circle(-50,180)
turtle.left(180)
turtle.circle(100,180)
turtle.end_fill()
#绘制左半边的大圆
turtle.circle(100,180)
#绘制第一个小圆
turtle.penup() #抬笔,移动时不会留下痕迹
turtle.goto(0,175) #移动到坐标(0,175)的位置
turtle.pendown() #落笔,准备绘制
turtle.color("black","black") #设置画笔颜色
turtle.begin_fill()
turtle.circle(20) #绘制半径为20的圆
turtle.end_fill()
#绘制第二个小圆
turtle.penup() #抬笔,移动时不会留下痕迹
turtle.goto(0,75) #移动到指定坐标
turtle.pendown() #落笔,准备绘制
turtle.color("black","white") #设置画笔颜色为黑色,填充色为白色
turtle.begin_fill()
turtle.circle(20) #绘制半径为20的圆
turtle.end_fill()
turtle.done()
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