1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python表白代码-如何用Python代码向心爱的姑娘花式表白?

python表白代码-如何用Python代码向心爱的姑娘花式表白?

时间:2023-07-13 11:35:24

相关推荐

python表白代码-如何用Python代码向心爱的姑娘花式表白?

刚好之前用turtle 写过一个/video/1058809172984004608

这是我当时自学python第二天写的一个,书上讲到了一个turtle模块,可以用来画一些简单的图,自己突发奇想就在纸上大概设计了一下图形,算了算长度后,用代码实现。可以说是很低等级的代码了,但当时觉得挺好玩的。

代码如下:

import turtle

import math

t=turtle.pen()

t=turtle

t.up()

t.goto(0,150)

t.down()

t.color('red')

t.begin_fill()

t.fillcolor('red')

t.speed(1)

t.left(45)

t.forward(150)

t.right(45)

t.forward(100)

t.right(45)

t.forward(100)

t.right(45)

t.forward(100)

t.right(45)

t.forward(250+math.sqrt(2)*100)

t.right (90)

t.speed(2)

t.forward(250+100*math.sqrt(2))

t.right(45)

t.forward(100)

t.right(45)

t.forward(100)

t.right(45)

t.forward(100)

t.right(45)

t.forward(150)

t.end_fill()

t.goto(-10,0)

t.pencolor('white')

#L

t.pensize(10)

t.goto(-50,0)

t.goto(-50,80)

t.up ()

#I

t.goto(-100,0)

t.down()

t.goto(-160,0)

t.goto(-130,0)

t.goto(-130,80)

t.goto(-160,80)

t.goto(-100,80)

t.up()

#O

t.goto(10,25)

t.down()

t.right(45)

t.circle(25,extent=180)

t.goto(60,55)

t.circle(25,extent=180)

t.goto(10,25)

t.up()

t.goto(75,80)

t.down()

t.goto(100,0)

t.goto(125,80)

t.up()

t.goto(180,80)

t.down()

t.goto(140,80)

t.goto(140,0)

t.goto(180,0)

t.up()

t.goto(180,40)

t.down()

t.goto(140,40)

#U

t.up()

t.goto(-40,-30)

t.down()

t.goto(-40,-80)

t.circle(40,extent=180)

t.goto(40,-30)

t.hideturtle()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。