python简单代码表白-如何正确使用Python进行表白
原标题:如何正确使用Python进行表白
提到程序员,
可能每个同学都认识一个——
爱穿格子衬衫、冲锋衣,爱宅着敲代码的程序员或者准程序员,
他们仿佛永远在bug和debug的路上,
还总爱自黑自己是“单身狗”,
你可能认为他们是这样的:
这样的
还有这样的
其实不然
一些程序员表面上看似孤身一人
其实人家已经悄咪咪的找了女朋友
单身的朋友依旧独自行走在冬夜的冷风中
总不能用代码写一个女朋友出来吧
程序员版本《恋爱宝典》
你值得拥有
表白的错误示范
大胆冒失型:
缺根筋型:
用力过猛型:
其实程序员们也有属于自己的浪漫啦,譬如Python、C、Java、C#等等等~都有很强悍的撩妹功能。
本期,小编为大家带来使用Python表白的各种姿势。如果再学不会,那就真的是凭自己的本事单身了!
01
初阶版:一行代码画出爱心♡
使用语言:Python
代码:print('n'.join([''.join([('Love umd'[(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)])
效果图:
02
进阶版:python + 数学= LOVE YOU
使用语言:Python
代码:
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 ((heartX*0.03)**2+(heartY*0.03)**2-1)**3-(heartX*0.03)**2*(heartY*0.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()
效果图:
03
终极版:用Python画一只玫瑰
使用语言:Python
代码:
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)
效果图:
怎么样?
各位霸霸们,get到新技能了吗
还有什么新奇的招数
热烈欢迎程序猿霸霸们
在留言板给大家提点一番
编辑丨赵奉超
图源 | 梦游家、网络
责任编辑:
python简单代码表白-如何正确使用Python进行表白相关推荐
- python简单代码-手把手教你用Python创建简单的神经网络(附代码)
了解神经网络工作方式的***途径莫过于亲自创建一个神经网络,本文将演示如何做到这一点. 神经网络(NN)又称人工神经网络(ANN),是机器学习领域中基于生物神经网络概念的学习算法的一个子集. 拥有五年 ...
- python简单代码画曲线图教程-用Python画论文折线图、曲线图?几个代码模板轻松搞定!...
前言 这几天在搞论文图,唉说实话抠图这种东西真能逼死人.坐在电脑前抠上一天越看越丑,最后把自己丑哭了-- 到了画折线图分析的时候,在想用哪些工具的时候.首先否决了excel,读书人的事,怎么能用exc ...
- python简单代码画皮卡丘-利用Python绘制萌萌哒的皮卡丘
开发工具 Python版本:3.6.4 运用的一些简单的算法 注:想学习Python的小伙伴们 可以 进群:984632579 领取从0到1完整学习资料 视频 源码 精品书籍 一个月经典笔记和99道练 ...
- python简单代码制作小游戏-用Python设计一个经典小游戏
本文主要介绍如何用Python设计一个经典小游戏:猜大小. 在这个游戏中,将用到前面我介绍过的所有内容:变量的使用.参数传递.函数设计.条件控制和循环等,做个整体的总结和复习. 游戏规则: 初始本金是 ...
- python简单代码画皮卡丘-用python画一只可爱的皮卡丘
#!/usr/bin/env python # -*- coding:utf-8 -*- from turtle import * ''' 绘制皮卡丘头部 ''' def face(x,y): &qu ...
- python简单代码画皮卡丘-用python画一只可爱的皮卡丘实例
效果图 #!/usr/bin/env python # -*- coding:utf-8 -*- from turtle import * ''' 绘制皮卡丘头部 ''' def face(x,y): ...
- python简单代码hello-[代码全屏查看]-python初学之helloworld
[2].[文件] data.txt ~ 8KB 下载(25) 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ...
- 以下python注释代码不正确的有_以下Python注释代码,不正确的是()
以下Python注释代码,不正确的是() 答://Python注释代码 初偏心会使轴心受压构件的稳定承载力降低.(?) 答:对 外国现代军事思想有___ 答:"总体战"理论 &qu ...
- python简单代码hello-小白学 Python(1):开篇
人生苦短,我用 Python 引言 大家好,可能大家都对我比较熟悉了,不熟悉请去面壁(现在熟悉一下也来得及)~ 简单做一个自我介绍,我是极客挖掘机的唯一作者,一位油腻的 Java 程序员[臭鸡蛋什么的 ...
最新文章
- 转 小辉_Ray CORS(跨域资源共享)
- RDKit | 基于Ward方法对化合物进行分层聚类
- 将截断字符串或二进制数据
- Lync Server 2013企业版部署系列之九:前端部署后续工作
- 数据结构与算法--求1~n能组成的所有二叉搜索树的排列
- html input 字体颜色_HTML常用标签汇总
- 整蛊小学妹,督促学习的html代码
- 泰拉瑞亚 服务器物品,terraria1.3全物品存档
- 存-管-用 联想企业网盘融云一体机让协同办公变得简单
- 如何防止服务器被攻击?
- 跳转到wps查看文件
- 如何搭建属于自己的腾讯云服务器
- 图片内容巴特勒 (隐藏文字到图片)
- python 椭圆检测_使用OpenCV和Python检测触摸/重叠圆/椭圆
- 在ubuntu 18上进行NPB和mpiP的整合
- 用python制作专属有声小说
- hadoop 透明加密先关命令
- 计算机软件创业论文,计算机软件专业创新创业人才培养对策论文
- 容器单机编排工具 Docker Compose,swap 限制,配置默认的CFS调度程序,Stress-ng 压力测试工具,docker官网镜像上传,及阿里云镜像上传,Docker 的资源限制
- 基于opencv使用人工图像处理算法实现车道偏离报警(LDW)