我目前在编写一个相当广泛的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'object is not callable”。我想知道它为什么打印这个错误以及如何修复它。非常感谢您对本项目的帮助
目前没有回答
相关问题 更多 >
编程相关推荐