记录#
- 今天没有知识点学习,只有编程训练。
- 编写一个宝可梦的字典,具有录入和打印功能。打印时要根据宠物属性输出对应颜色的文字。
- 对齐这部分还是不熟练,需要多做练习。
CODE#
print("👾 MokéBeast - The Non-Copyright Generic Beast Battle Game 👾")
print()
def color(c):
if c == "fire":
print("\033[31m")
if c == "water":
print("\033[34m")
if c == "electricity":
print("\033[33m")
if c == "grass":
print("\033[32m")
if c == "poison":
print("\033[35m")
moke = {"name":None, "type":None, "move":None, "HP":None, "MP":None, }
for name in moke.keys():
moke[name]=input(f"Input your beast's {name} > ")
for name,value in moke.items():
color(moke['move'])
print(f"{name: <15}:{value}")