获得徽章 6
赞了这篇沸点
🎄圣诞节 来段代码:
from colorama import Fore
def heart_shape(msg="Merry Christmas"):
lines = []
for y in range(15, -15, -1):
line = ""
for x in range(-30, 30):
f = ((x * 0.05) ** 2 + (y * 0.1) ** 2 - 1) ** 3 - (x * 0.05) ** 2 * (y * 0.1) ** 3
line += msg[(x - y) % len(msg)] if f <= 0 else " "
lines.append(line)
print(Fore.RED + "\n".join(lines))
print(Fore.GREEN + msg)
heart_shape()
from colorama import Fore
def heart_shape(msg="Merry Christmas"):
lines = []
for y in range(15, -15, -1):
line = ""
for x in range(-30, 30):
f = ((x * 0.05) ** 2 + (y * 0.1) ** 2 - 1) ** 3 - (x * 0.05) ** 2 * (y * 0.1) ** 3
line += msg[(x - y) % len(msg)] if f <= 0 else " "
lines.append(line)
print(Fore.RED + "\n".join(lines))
print(Fore.GREEN + msg)
heart_shape()
展开
6
8
赞了这篇沸点
赞了这篇文章
![[呲牙]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_2.cd1e2bd.png)
![[微笑]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_1.7d9f699.png)
![[看]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_97.39cdc9f.png)
![[晕]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_33.12a8e53.png)