小言_互联网的博客

利用python写中国心

241人阅读  评论(0)

今年是祖国70周年的生日,很多人都想要表达自己对祖国的热爱。在此我自己写了一个小程序画出一颗炙热的爱国之心。废话不多说直接看代码!`
from turtle import *
pensize(2)
speed(10)
def shit():
right(1)
fd(1)
return

def Dra():
begin_fill()
color(“yellow”,“yellow”)
pendown()
for i in range(5):
fd(35)
right(144)
end_fill()
return
def Dra1():
begin_fill()
color(“yellow”,“yellow”)
pendown()
for i in range(5):
fd(15)
right(144)
end_fill()
return
speed(3)
#心形
begin_fill()
color(“red”,“red”)
left(20)
#fd(5)
circle(180,56)
shit()
circle(60,180)
right(150)
circle(60,180)
shit()
circle(180,55)
left(20)
end_fill()

#五角星
pensize(1)
penup()
goto(-105,150)
Dra()
penup()
goto(-60,175)
left(65)
Dra1()
penup()
goto(-40,155)
right(25)
Dra1()
penup()
goto(-40,125)
right(35)
Dra1()
penup()
goto(-60,100)
right(30)
Dra1()
hideturtle()
`


转载:https://blog.csdn.net/qq_43313021/article/details/101934399
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场