mport turtle |
myPen = turtle.Pen() |
print ( '欢迎来到汉堡店' ) |
myPen.left( 90 ) |
myPen.hideturtle() |
# 汉堡底层 |
myPen.fillcolor( 'tan1' ) |
myPen.begin_fill() |
myPen.circle( 50 ) |
myPen.end_fill() |
# 汉堡夹心层 |
num = int ( input ( '您需要多少层?' )) |
if (num > 0 ): |
print ( '开始点餐' ) |
else : |
print ( '至少要一层汉堡' ) |
i = 0 |
while (i < num): |
extra = input ( '输入Y加入牛肉,输入p加番茄,输入u加芝士,输入n加青菜。' ) |
if (extra = = 'y' ): |
color = 'saddle brown' |
elif (extra = = 'u' ): |
color = 'yellow1' |
elif (extra = = 'n' ): |
color = 'green' |
elif (extra = = 'p' ): |
color = 'tomato' |
else : |
print ( '没有这个夹心哦~~' ) |
break |
myPen.penup() |
myPen.forward( 7 ) |
myPen.pendown() |
myPen.fillcolor(color) |
myPen.begin_fill() |
myPen.circle( 50 ) |
myPen.end_fill() |
i = (i + 1 ) |
# 汉堡底层 |
myPen.penup() |
myPen.forward( 7 ) |
myPen.pendown() |
myPen.fillcolor( 'tan1' ) |
myPen.begin_fill() |
myPen.circle( 50 ) |
myPen.end_fill() |
print ( '欢迎下次光临' ) |
turtle.done() |
初级程序员
by: sleg程序员 发表于:2022-03-01 10:46:51 顶(1) | 踩(1) 回复
wc
网友回复
回复张书娥 : ???
顶(1) 踩(1) 2022-05-07 16:56:01
回复评论