Python语言打印❤

#---cc_jiao ---

 
import time
 
# 打印爱心图案
def print_love():
    myData = "o"
    for char in myData.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 <= 0:
                    lst_con += char[(x) % len(char)]
                else:
                    lst_con += ' '
            lst.append(lst_con)
            allChar += lst
        print('\n'.join(allChar))
        time.sleep(1)
 
if __name__ == '__main__':
    print_love()

效果图如下:

Python语言打印❤_第1张图片

 

你可能感兴趣的:(python,开发语言)