python use turtle It is convenient to draw simple patterns , Freshman school python Of turtle Module time , Remember to draw all kinds of patterns , Such as the national flag , Peach heart and so on , The final course design may also encounter painting 54 Playing cards , My roommate was forced to choose this question . Sometimes the program ape met his favorite girl and didn't dare to confess , Then use it turtle Let's make it clear !!!!!!! Here's the program .
import turtle import time def LittleHeart(): for i in range(200):
turtle.right(1) turtle.forward(2) isLove=input(' Will you always love her ?(Y or N)\n') run =1
while(run): if isLove=="Y": me="" love="" if love=='': love=' strawberry I love you'
turtle.setup(width=900, height=500) turtle.color('red','red') turtle.pensize(3)
turtle.speed(50) turtle.up() turtle.hideturtle() turtle.goto(0,-180)
turtle.showturtle() turtle.down() turtle.speed(5) turtle.begin_fill()
turtle.left(140) turtle.forward(224) LittleHeart() turtle.left(120)
LittleHeart() turtle.forward(224) turtle.end_fill() turtle.pensize(5)
turtle.up() turtle.hideturtle() turtle.goto(0,0) turtle.showturtle()
turtle.color('#CD5C5C','blue')
turtle.write(love,font=('gungsuh',30,),align="center") turtle.up()
turtle.hideturtle() if me !='': turtle.color('yellow', 'red') time.sleep(2)
turtle.goto(180,-180) turtle.showturtle() turtle.write(me, font=(20,),
align="center", move=True) window=turtle.Screen() window.exitonclick() run =0
else: print(" Deserve to be single for a lifetime ") print("!!!!!!!!! I'll give you another chance !!!!!!!!")
isLove=input(' Will you always love her ?(Y or N)\n') continue
Operation results :

 

 

 

 

A poem attached :

                                《 Chanting plum 》

 

                                                        Plum blossoms in the Wangs ,

                                                        Day and night together ,

                                                        Plum blossom with fragrance ,

                                                        I think beauty is better than national fragrance ,

                                                        Don't laugh when you fall in love with dark fragrance ,

                                                        If you see may, you will be demented .

 

 

Technology