⽤java在命令⾏⾥⾯表⽩_情⼈节就要到了,教你如何⽤代码
去表⽩!
当“昂贵的鲜花+浪漫的烛光晚餐”的标配表⽩⽅式早已落⼊俗套,⾝为程序员的我们,不应该拥有⾃⼰专属的浪漫吗?
是⽤代码表达爱意,或是⽤base64加密你对她的告⽩,还是以她的名字为域名,为她编写专属于她的⽹站?
"我写过最得意的代码,就是让你答应做我⼥朋友的那串代码。"
撩妹可不能全靠⼀张嘴
礼物⼀定要⾛⼼⼜有⼼!
恋习Python教你⼀招
搞定速速开撩!
福利时刻
(1)静态⼼
import matplotlib.pyplot as plt
import numpy as np
t=np.arange(0,2*np.pi,0.1)
x=16*np.sin(t)**3
y=s(t)-s(2*t)-s(3*t)-np.cos(4*t)
plt.plot(x,y,color="red")
plt.show()
程序员html表白源代码
运⾏结果为:
(2)动态⼼
from turtle import *
def curvemove():
for i in range(200):
right(1)
forward(1)
turtle.title("请⼈节")#为图像设置标题
turtle.pensize(width=5)#画笔宽度
color("red","pink")#画笔颜⾊以及填充颜⾊
begin_fill()
left(140)#逆时针旋转140度
turtle.speed(1)#画线速度
forward(111.65)#向前⾏⾛111.65
curvemove()#调⽤curvemove函数
left(120)
curvemove()
turtle.speed(1)
forward(111.65)
end_fill()
turtle.up()#停⽌画线
left(230)
forward(75)
turtle.write("I LOVE YOU ",align="Center",font=("Arial", 16, "normal")) done()
运⾏结果为:
(3)⼀⾏代码画⼼
print('\n'.join([''.join([('AndyLove'[(x-y)%8]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)]))
运⾏结果为:
(4)玫瑰花
情⼈节,必不可少的是玫瑰花,那就⽤Python画个玫瑰花吧。
①定义画布和画笔
import turtle
turtle.speed(10)
②⾸先勾画花蕊
def flower():
<(0, 200) turtle.fillcolor("red") turtle.begin_fill() turtle.circle(10, 180) turtle.circle(25, 110) turtle.left(50)
turtle.circle(60, 45) turtle.circle(20, 170) turtle.right(24) turtle.fd(30)
turtle.left(10)
turtle.circle(30, 110) turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70) turtle.circle(30, 150) turtle.right(30) turtle.fd(15)
turtle.circle(80, 90) turtle.left(15)
turtle.fd(45)
turtle.right(165) turtle.fd(20)
turtle.left(155) turtle.circle(150, 80) turtle.left(50)
turtle.circle(150, 90) d_fill()
③勾画左边的花瓣
turtle.circle(-90, 70) turtle.left(20)
turtle.circle(75, 105) turtle.setheading(60) turtle.circle(80, 98) turtle.circle(-90, 40)④勾画右边的花瓣
def peta2():
turtle.left(180)
turtle.circle(90, 40) turtle.circle(-80, 98) turtle.setheading(-83)⑤勾画枝⼦上左边的叶⼦def leaf1():
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green") turtle.begin_fill() turtle.circle(-80, 90) turtle.right(90)
turtle.circle(-80, 90) d_fill()
turtle.right(135) turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
⑥勾画树枝上右边的叶⼦def leaf2():

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。