大家好久不见啊!!!今天终于有时间了,我写了一个雪融融像素画的代码,大家一起来看看:
# 设计字符画
ls = [[9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,4,9,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,9,9,9,9,9,4,4,9,9,4,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,9,9,9,1,1,4,9,4,9,9,4,9,9,9,9,9,9], [9,9,9,9,9,9,9,9,1,1,9,9,9,4,4,4,4,1,9,9,9,9,9,9], [9,9,9,9,9,9,1,1,1,9,9,9,9,9,9,9,9,9,1,9,9,9,9,9], [9,9,9,9,9,1,4,2,4,2,1,1,1,1,1,1,9,9,9,1,9,9,9,9], [9,9,9,9,1,2,2,2,2,4,2,4,2,4,2,2,1,1,1,9,1,9,9,9], [9,9,9,1,2,2,2,2,2,2,2,2,2,2,2,4,2,4,4,1,9,1,9,9], [9,9,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,1,1,9,9], [9,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,9,9], [9,1,2,2,2,2,2,9,9,9,9,2,2,2,2,2,2,2,2,2,2,2,1,9], [1,2,2,2,9,9,9,9,9,9,9,9,9,2,2,2,2,2,2,2,2,2,1,9], [1,2,2,2,9,9,9,9,9,9,9,9,9,9,2,2,2,2,2,2,2,2,1,9], [1,2,2,9,9,9,9,1,9,9,9,9,9,9,9,9,9,2,2,2,2,2,2,1], [1,2,2,9,2,2,9,9,9,9,9,9,9,1,9,9,9,9,2,2,2,2,2,1], [9,1,2,9,9,9,9,9,9,9,9,9,9,9,9,2,2,9,2,2,2,2,2,1], [9,1,2,2,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,2,2,2,1,9], [9,9,1,2,2,2,2,2,2,9,9,9,9,9,9,9,9,9,9,2,2,2,1,9], [9,9,1,2,2,2,2,2,2,2,9,9,9,9,9,9,2,2,2,2,2,2,1,9], [9,9,9,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,9,9], [9,9,9,9,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,9,9], [9,9,9,9,1,2,2,1,2,2,2,2,2,2,2,2,2,2,1,1,9,9,9,9], [9,9,9,9,1,2,2,4,4,4,4,4,4,4,4,4,4,4,9,9,9,9,9,9], [9,9,9,9,9,1,2,4,4,4,4,4,4,4,4,4,4,1,9,9,9,9,9,9], [9,9,9,9,9,9,1,4,4,2,2,9,9,2,1,2,2,2,1,9,9,9,9,9], [9,9,9,9,9,9,1,4,4,2,1,1,1,1,2,1,2,2,1,9,9,9,9,9], [9,9,9,9,9,9,1,2,2,9,9,2,9,9,9,2,1,1,1,9,9,9,9,9], [9,9,9,9,9,9,1,2,2,2,9,5,3,9,2,2,1,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,1,2,2,2,9,9,2,2,2,1,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,1,2,2,2,2,2,2,2,2,1,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,9,1,2,2,2,1,2,2,2,1,9,9,9,9,9,9,9], [9,9,9,9,9,9,9,9,1,1,1,1,9,1,1,1,9,9,9,9,9,9,9,9]] # 遍历行 for row in range(len(ls)): # 遍历列 for column in range(len(ls[row])): # 输出列表元素 print_square(ls[row][column]) print()
没什么难点,就是打图的时候比较难,其他还好;
拜拜啦!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
本站作者已申明原创,禁止转载!
文章内容属作者个人观点,不代表本站立场,如有侵权立删。