怎么用python表白_如何正确使用Python进行表白?这是个值得思考的问题!
提到程序員,
可能每個同學都認識一個——
愛穿格子襯衫、沖鋒衣,愛宅著敲代碼的程序員或者準程序員,
他們仿佛永遠在bug和debug的路上,
還總愛自黑自己是“單身狗”,
如何正確使用Python進行表白?這是個值得思考的問題!
你可能認為他們是這樣的:
如何正確使用Python進行表白?這是個值得思考的問題!
這樣的
如何正確使用Python進行表白?這是個值得思考的問題!
還有這樣的
如何正確使用Python進行表白?這是個值得思考的問題!
其實不然
一些程序員表面上看似孤身一人
其實人家已經悄咪咪的找了女朋友
單身的朋友依舊獨自行走在冬夜的冷風中
總不能用代碼寫一個女朋友出來吧
程序員版本《戀愛寶典》
你值得擁有
表白的錯誤示范
大膽冒失型:
如何正確使用Python進行表白?這是個值得思考的問題!
缺根筋型:
如何正確使用Python進行表白?這是個值得思考的問題!
用力過猛型:
如何正確使用Python進行表白?這是個值得思考的問題!
如何正確使用Python進行表白?這是個值得思考的問題!
其實程序員們也有屬于自己的浪漫啦,譬如Python、C、Java、C#等等等~都有很強悍的撩妹功能。
本期,小編為大家帶來使用Python表白的各種姿勢。如果再學不會,那就真的是憑自己的本事單身了!
如何正確使用Python進行表白?這是個值得思考的問題!
01
初階版:一行代碼畫出愛心?
使用語言:Python
代碼:print(''.join([''.join([('Love umd'[(x-y)%8]if((x0.05)2+(y0.1)2-1)3-(x0.05)2(y0.1)*3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)])
效果圖:
如何正確使用Python進行表白?這是個值得思考的問題!
02
進階版:python + 數學= LOVE YOU
使用語言:Python
代碼:
import matplotlib.pyplot as pltimport seaborn
import numpy
l = numpy.arange(0, 4, 0.01)
L = 1.0 / l
theta = numpy.arange(-4, 4, 0.01)
o = 3.0 * numpy.cos(theta)
O = 3.0 * numpy.sin(theta)
v = numpy.arange(-4, 4, 0.01)
V = numpy.abs(-2.0 * v)
e = numpy.arange(-3, 3, 0.01)
E = -1.0 * numpy.abs(numpy.sin(e))
y = numpy.arange(-10, 10, 0.01)
Y = numpy.log2(numpy.abs(y))
u = numpy.arange(-4, 4, 0.01)
U = 2.0 * u ** 2
points = []
for heartY in numpy.linspace(-100, 100, 500):
for heartX in numpy.linspace(-100, 100, 500):
if ((heartX0.03)2+(heartY0.03)2-1)3-(heartX0.03)2(heartY0.03)*3 <= 0:
points.append({"x": heartX, "y": heartY})
heart_x = list(map(lambda point: point["x"], points))
heart_y = list(map(lambda point: point["y"], points))
fig = plt.figure(figsize=(13, 7))
ax_L = fig.add_subplot(2, 4, 1)
ax_O = fig.add_subplot(2, 4, 2)
ax_V = fig.add_subplot(2, 4, 3)
ax_E = fig.add_subplot(2, 4, 4)
ax_Y = fig.add_subplot(2, 4, 5)
ax_O_2 = fig.add_subplot(2, 4, 6)
ax_U = fig.add_subplot(2, 4, 7)
ax_heart = fig.add_subplot(2, 4, 8)
plt.plot(colos='tomato')
ax_L.plot(l, L)
ax_O.plot(o, O)
ax_V.plot(v, V)
ax_E.plot(E, e)
ax_Y.plot(y, Y)
ax_Y.axis([-10.0, 10.0, -10.0, 5.0])
ax_O_2.plot(o, O)
ax_U.plot(u, U)
ax_heart.scatter(heart_x, heart_y, s=10, alpha=0.5)
seaborn.set_style('whitegrid')
plt.show()
效果圖:
如何正確使用Python進行表白?這是個值得思考的問題!
03
終極版:用Python畫一只玫瑰
使用語言:Python
代碼:
import turtleimport time
writing txt
turtle.hideturtle()
turtle.penup()
turtle.goto(130, 50)
turtle.pendown()
turtle.color("blue")
turtle.write("親愛的,給你畫個東西", font=("Times", 18, "bold"))
time.sleep(2)
turtle.goto(180, 10)
turtle.write("開始了哈~", font=("Times", 18, "bold"))
time.sleep(2)
turtle.goto(200, -20)
turtle.write("Ready?", font=("Times", 18, "bold"))
time.sleep(2)
turtle.goto(215, -50)
turtle.write("go!", font=("Times", 18, "bold"))
time.sleep(2)
turtle.end_fill()
設置初始位置
turtle.goto(0, 0)
turtle.color("black")
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
花蕊
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)
turtle.end_fill()
花瓣1
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)
花瓣2
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)
葉子1
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)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)
葉子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
time.sleep(2)
turtle.penup()
turtle.color("blue")
turtle.goto(180, -100)
turtle.write("umd送給你", font=("Times", 18, "bold"))
time.sleep(20)
效果圖:
如何正確使用Python進行表白?這是個值得思考的問題!
怎么樣?
各位霸霸們,get到新技能了嗎
如何正確使用Python進行表白?這是個值得思考的問題!
還有什么新奇的招數
熱烈歡迎程序猿霸霸們
總結
以上是生活随笔為你收集整理的怎么用python表白_如何正确使用Python进行表白?这是个值得思考的问题!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 爱荷华大学计算机科学专业,爱荷华大学计算
- 下一篇: jquery获取html页面参数乱码,J