战术游戏中的Python运行时错误:字典对象不可调用

时间:2018-07-15 02:04:06

标签: python dictionary runtime

我目前正在编写一个相当广泛的Python程序时遇到问题。该程序是游戏的战术计算器,如下所示。

# Tactical Calculator

budget = int(input("budget per round:"))
amount = int(input("ingots per round:"))
rounds = int(input("rounds:"))
infantry_budget = {'assault': 80,
            'light': 90,
            'motorized': 100,
            'commando': 150}
engine_budget = {'armored': 135,
          'tank': 180,
          'heavy tank': 240,
          'super tank': None}
artillery_budget = {'battalion': 120,
             'field': 200,
             'rocket': 220}
amount1 = [int((budget * rounds) / infantry_budget["light"]), int((budget * rounds) / infantry_budget["assault"]), int((budget * rounds) / infantry_budget["motorized"]),
                     int((budget * rounds) / infantry_budget["commando"])]
print(amount1)
amount2 = [int((budget * rounds) / engine_budget['armored']), int((budget * rounds) / engine_budget(['tank'])), int((budget * rounds) / engine_budget['heavy tank'])]
print(amount2)
infantry_ingots = {'assault': 10,
                   'motorized': 30,
                   'commando': 45}
engine_ingots = {'armored': 60,
                 'tank': 90,
                 'heavy tank': 145,
                 'super tank': None}
artillery_ingots = {'battalion': 50,
                    'field': 80,
                    'rocket': 100}

我遇到的问题是,打印出amount1之后,Python Shell会打印运行时错误,指出“'dict'对象不可调用”。我想知道为什么打印此错误以及如何解决它。非常感谢您提供有关此计划的任何帮助。

0 个答案:

没有答案