心血来潮突然想用python画一面五星红旗,由于我对程序的掌握还不是特别全面不知道怎么缩短,所以代码比较多,还有五角星的代码也是参考其他人的。整个程序都是以坐标绘图为主是比较基础的,还有五角星也是。以下是原代码,可以直接食用
import turtle
turtle.fillcolor("red")
turtle.begin_fill()
turtle.penup()
turtle.goto(-60,0)
turtle.pendown()
turtle.goto(-60,160)
turtle.goto(240,160)
turtle.goto(240,0)
turtle.goto(-60,0)
turtle.end_fill()
import turtle
turtle.penup()
turtle.goto(-50,110)
turtle.fillcolor("yellow")
turtle.begin_fill()
count = 1
while count <= 5:
turtle.forward(45)
turtle.right(144)
count += 1
turtle.end_fill()
import turtle
turtle.penup()
turtle.goto(-10,145)
turtle.fillcolor("yellow")
turtle.begin_fill()
count =