2014-08-31 38 views
-5

我检查了30多次,我不知道字符串有什么问题。它一定是我看不到的小事。EOL在扫描字符串文字时,文件将不会运行

#Description 

print("Costs of EMS responses") 

Print("Choose the costs of providing Emergency Medical Services \ 
    + \n to your region. Remember, half will be covered by insurance \ 
    + \n of the patient then the rest will have to be paid out of pocket \ 
    + \n by the patient himself/herself. 
") 

#Variables 

als = int(input("Advanced Life Support: ")) 
bls = int(input("Basic Life Support: ")) 
fireresponse = int(input("Fire Response: ")) 
aeromedical = int(input("EMS Helicopter: ")) 
citypolice = int(input("City Police: ")) 
statepolice = int(input("State Police: ")) 
countypolice = int(input("County Police: ")) 
swat = int(input("SWAT Team: ")) 
total = als + bls + fireresponse + aeromedical + citypolice + statepolice + countypolice + swat 

print("\nCombined amount of costs from services in the region: ", total) 

input("\n\n\nPress enter to exit menu) 
+0

线5:为什么印刷资本P? – chucksys 2014-08-31 23:03:53

+0

而不是丑陋的线延续,考虑多线字符串和'textwrap.dedent'(请参阅,例如http://codereview.stackexchange.com/a/60369/32391)。 – jonrsharpe 2014-08-31 23:10:04

回答

1

这里是第一个,我看到:

input("\n\n\nPress enter to exit menu) 

,第二个是你忘了在此行的末尾逃脱代码换行符:

+ \n by the patient himself/herself. 
+0

编辑并打印出大写的P.它主要突出了变量之下的东西,但我不再看到这些问题。它突出显示了括号后面的单词“int(input(”...虽然我不明白它是如何做错的,我现在正在从一本书学习,而这正是它如何写在那里.. – Pythonhelper 2014-08-31 23:09:13

+0

是的,这是它。不知道为什么它突出显示不同的东西。我感谢你的帮助! – Pythonhelper 2014-08-31 23:10:45

+0

@Pythonhelper:你忘了关闭最后一行的字符串。 – Matthias 2014-09-01 06:23:30

相关问题