一行代码系列

一行代码九九乘法表

ret = '\n'.join('\t'.join(['%s*%s=%s'%(j,i,i*j) for j in range(1,i+1)]) for i in range(1,10))
print(ret)

一行代码随机验证码

ret = '\n'.join([''.join([str(random.randint(0,9)) for i in range(6)])])
print(ret)

一行代码画出❤

ret = '\n'.join([''.join([('Love You'[(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)])
print(ret)

 

posted @ 2018-06-22 19:12  Leslie-x  阅读(235)  评论(0编辑  收藏  举报