学习Python从娃娃抓起!记录下蓝桥杯Python学习和备考过程中的题目,记录每一个瞬间。
附上汇总贴:小学生蓝桥杯Python闯关 | 汇总_COCOgsta的博客-CSDN博客
【题目描述】
使用它turtle绘制右图。
要求:
【代码详解】
import turtle as t
t.hideturtle()
t.speed(9)
for x in range(6):
t.forward(150)
t.fillcolor("green")
t.begin_fill()
for y in range(3):
t.right(120)
t.forward(150)
t.left(60)
t.end_fill()
t.fillcolor("red")
t.begin_fill()
for x in range(6):
t.forward(150)
t.left(60)
t.end_fill()
t.done()
复制代码
【运行结果】
页面更新:2024-04-23
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号