为什么我在python 3.6中得到随机语法错误
问题描述:
您好我已经做了一段代码,从我可以看到看起来都很好,但是当我试图运行它时,它出现了一个语法错误,罚款(如图)。我对Python非常陌生,我只学习了基础知识,希望有人能找到解决方案。为什么我在python 3.6中得到随机语法错误
name = input('what is your name')
print ('hello' + name)
print (',it is late december of 2025 and the nuke has been drooped over sheffield. you are our only hope') #this explanes the background story and askes the players name
print ('please help us. we need you,' + name)
job = input('please choose a class. medic, gunsman or scientist')
if job == medic
bandages = 5
drugs = 5
clean_siringes = 5
dirty siringes = 0 #this sets the players items to the right amount
health = 100
food = 100
water = 100 #this sets the players food, water, health and the citys peoples happiness
peoples_happiness = 100
print ('bandages' + bandages)
print ('drugs' + drugs)
print ('clean_siringes' + clean_siringes)
print ('dirty siringes' + dirty_siringes)
print ('health' + health
print ('food' + food)
print ('water' + water)
print ('peoples_happiness' + peoples_happiness)
这里有语法错误的图片:
答
你缺少冒号在if
声明
if job == medic:
结束,再加上你需要缩进的行那些在if
子句中。
+1
只需留下评论并将其作为简单的印刷错误关闭即可...... –
+0
我猜他也意味着'if job =='医生“'。 –
你错过了':'。 –
a':'后面的单词'medic'比较需要用冒号结尾 – WhatsThePoint