有意思的代码(有趣)

心形代码

print(
    '\n'.join(
        [
            ''.join(
                [
                    ('LLoveZ'[(x-y)%6]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)
        ]
    )
)

动态花

#exec("""\nfrom turtle import *\nfor i in range(500): \n    forward(i)\n    left(91)\n""")

import turtle
for i in range(500):
    turtle.forward(i)
    turtle.left(91)

你可能感兴趣的:(有意思的代码(有趣))