美文网首页码农的世界
如何正确使用Python进行表白?这是个值得思考的问题!

如何正确使用Python进行表白?这是个值得思考的问题!

作者: b4a0155c6514 | 来源:发表于2019-01-05 11:03 被阅读0次

提到程序员,

可能每个同学都认识一个——

爱穿格子衬衫、冲锋衣,爱宅着敲代码的程序员或者准程序员,

他们仿佛永远在bug和debug的路上,

还总爱自黑自己是“单身狗”,

如何正确使用Python进行表白?这是个值得思考的问题!

你可能认为他们是这样的:

如何正确使用Python进行表白?这是个值得思考的问题!

这样的

如何正确使用Python进行表白?这是个值得思考的问题!

还有这样的

如何正确使用Python进行表白?这是个值得思考的问题!

其实不然

一些程序员表面上看似孤身一人

其实人家已经悄咪咪的找了女朋友

单身的朋友依旧独自行走在冬夜的冷风中

总不能用代码写一个女朋友出来吧

程序员版本《恋爱宝典》

你值得拥有

表白的错误示范

大胆冒失型:

如何正确使用Python进行表白?这是个值得思考的问题!

缺根筋型:

如何正确使用Python进行表白?这是个值得思考的问题!

用力过猛型:

如何正确使用Python进行表白?这是个值得思考的问题! 如何正确使用Python进行表白?这是个值得思考的问题!

其实程序员们也有属于自己的浪漫啦,譬如Python、C、Java、C#等等等~都有很强悍的撩妹功能。

本期,小编为大家带来使用Python表白的各种姿势。如果再学不会,那就真的是凭自己的本事单身了!

如何正确使用Python进行表白?这是个值得思考的问题!

01

初阶版:一行代码画出爱心♡

使用语言:Python

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;">代码: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)])
</pre>

效果图

如何正确使用Python进行表白?这是个值得思考的问题!

02

进阶版:python + 数学= LOVE YOU

使用语言:Python

代码

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> import matplotlib.pyplot as plt
import 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()
</pre>

效果图

如何正确使用Python进行表白?这是个值得思考的问题!

03

终极版:用Python画一只玫瑰

使用语言:Python

代码

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;">import turtle
import 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)
</pre>

效果图

如何正确使用Python进行表白?这是个值得思考的问题!

怎么样?

各位霸霸们,get到新技能了吗

如何正确使用Python进行表白?这是个值得思考的问题!

还有什么新奇的招数

热烈欢迎程序猿霸霸们

相关文章

  • 如何正确使用Python进行表白?这是个值得思考的问题!

    提到程序员, 可能每个同学都认识一个—— 爱穿格子衬衫、冲锋衣,爱宅着敲代码的程序员或者准程序员, 他们仿佛永远在...

  • 这是个值得思考的问题!

    之前一直喜欢一个人在外,自由自在,无牵无挂,到了这个年纪突然懂了,最幸福的事,不是一个人在外漂泊,自得其乐。而是父...

  • 爱你还是更爱你

    这是个值得思考的问题 莎士比亚

  • 如何进行正确的表白?

    真正的恋爱是不需要表白的,所谓表白死就是这个道理,关系的确认是两厢情愿,水到渠成的事情,切勿在前期表白,暴露需求感...

  • 使用 Python 进行并发编程系列 - 收藏集 - 掘金

    使用 Python 进行并发编程 - asyncio 篇 (三) - 掘金 这是「使用Python进行并发编程...

  • 2020-08-19

    2020.8.19 想得太多——这是个值得思考的问题

  • 生活随感

    生活是枯燥的,也是美好的!怎样正确使用,是个值得思考的问题。生活不是商品,没有使用说明书,你只能自己在这条路上一步...

  • 《学会提问》笔记

    问题 如何对观点进行分析 如何与人进行探讨 如何形成自己的观点 概述 是否存在正确答案:问题类型决定是否有正确答案...

  • 实用性思考的艺术【周未荐书】

    这是一本教人如何思考的书。 每个人都能思考,但真正会思考的人极少。 在正式开始学习之前,有个问题非常值得思考——为...

  • 约不约这是个值得思考的问题

    如今,谁也不愿打扰谁,谁也不愿被打扰。 有一天,有一刻,我鼓起满满的勇气,却换来满满的失落,我愿意以后再也不勇敢。...

网友评论

    本文标题:如何正确使用Python进行表白?这是个值得思考的问题!

    本文链接:https://www.haomeiwen.com/subject/bzrrrqtx.html