我需要计算总数...得到 0.00
还需要住宅、商业、城市和教区打印
这是我更新的代码,
print("=========================================================")
print(format("Name", '<12s'),format("Type", '<15s'),format("Location",'<10s'),format("KwH", '<8s'),format("Total", '>8s'))
print("=========================================================")
total = 0
for i in range(10):
custName = input()
custType = input()
custLoc = input()
custKwh = eval(input())
if (custType == "R"):
custType = "Residential"
if (custType == "B"):
custType = "Business"
total = (custKwh * 0.05710) + 10
if (custLoc == "C"):
custType = "City"
total = (custKwh * 0.0401) + 6
if (custLoc == "P"):
custType = "Parish"
total = (custKwh * 0.04411) + 6.60
print(format(custName, '<12s'),format(custType, '<15s'),format(custLoc, '<10s'),format(custKwh, '<8d'),format(total, '<7.2f'))