while True:
n = 0
print("\n欢迎使用数字画图程序\n\n")
z = input(“请输入 1~7 的数字,分别对应 1 红 2 绿 3 黄 4 蓝 5 紫 6 青 7 黑和 0 空格和/换行:”)
for char in z:
if char == ‘1’:
print("\033[30;31;6m■", end="")
elif char == ‘2’:
print("\033[30;32;6m■", end="")
elif char == ‘3’:
print("\033[30;33;6m■", end="")
elif char == ‘4’:
print("\033[30;34;6m■", end="")
elif char == ‘5’:
print("\033[30;35;6m■", end="")
elif char == ‘6’:
print("\033[30;36;6m■", end="")
elif char == ‘7’:
print("\033[30;38;6m■", end="")
elif char == ‘0’:
print(" “, end=”")
elif char == ‘/’:
print()
choice = input(“Wanna continue 想继续吗? 1.continue 继续 0.exit 退出:”)
if choice == ‘0’:
break
Python数字画图程序代码
最新推荐文章于 2024-10-27 19:55:47 发布