因此,我正在尝试进行文本冒险,并尝试通过使用 list 来跟踪统计信息。
所以例如我有:
User_stats = []
User_weapon = ""
User_armor = ""
Sword = 10
Pike = 13
Crude = 2
Heavy = 5
print (weapons)
print ("First lets pick a weapon,(enter the type of weapon, not the name)")
User_weapon = input()
User_stats.append(User_weapon)
print (armor)
print("Now lets pick some armor (enter the first word of the armor)")
User_armor = input ()
User_stats.append(User_armor)
print (User_stats)
打印用户选择的列表[Sword, Crude]
。有没有办法从这些变量中提取值并将它们求和(以确定攻击是否成功)?
谢谢你的帮助!