Python错误:列表索引必须是整数或切片,而不是str

时间:2019-12-20 11:57:54

标签: python

我试图在我的游戏方法中使用药水,就像宠物小精灵一样,但是当我输入以下内容时会出错:

 if potions[enter] == weakness_potion:
                selected_tenemore[4] = selected_tenemore[4] - 10
                print("potion applied")
              elif potions[enter] == health_potion:
                using_monster[4] = using_monster[4] + 10
                print("potion applied")
              elif potions[enter] == strength_potion:
                using_monster[2] = using_monster[2] + 10
                using_monster[3] = using_monster [3] + 10
                print("potion applied")
              potions.pop(enter)

if语句和elif语句有错误

0 个答案:

没有答案