python画爱心代码大全 |
您所在的位置:网站首页 › python编出爱心 › python画爱心代码大全 |
大家好,又见面了,我是你们的朋友全栈君。 程序员在爱情方式上表达上展现的多种多样,其中现在大火的用编程去编写个表白内容,最受欢迎了,今天小编也尝试了下,一起来看看吧~ 准备工具:python3 画爱心实施步骤: 打开编译器,写上code,代码如下:from turtle import * pensize(1) pencolor(‘red’) fillcolor(‘pink’) speed(5) up() goto(-30,100) down() begin_fill() left(90) circle(120,180) circle(360,70) left(38) circle(360,70) circle(120,180) end_fill() up() goto(-100,-100) down() 效果展示: 上述是画一个爱心,还可以打印一个爱心哦~ 代码展示:import time sentence = “我爱你!” for char in sentence.split( ): allChar = [] for y in range(12, -12, -1): lst = [] lst_con = ” for x in range(-30, 30): formula = ((x * 0.05) ** 2 + (y * 0.1) ** 2 – 1) ** 3 – (x * 0.05) ** 2 * (y * 0.1) ** 3 if formula |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |