def main():
print "This Program will calculate the amount of parking charges by hours using a given list: "
ticket = raw_input("Please enter ticket. If lost, Please enter no")
if ticket in ['No','no','N','n']
hour = float(input("Enter total hour at parking deck: ")
while(hour <= 0 or hour > 24):
hour = int(input("Enter an integer between 1-24 (hour): "))
上面的代码在第6行的单词
处有语法错误答案 0 :(得分:1)
下面的行中缺少一个支架/支架。添加大括号,错误就会消失。
hour = float(input("Enter total hour at parking deck: ")
最后还需要一个冒号。以下是更正后的行
if ticket in ['No','no','N','n']:
hour = float(input("Enter total hour at parking deck: "))
答案 1 :(得分:1)
开始新版块的语句,例如if
和while
,最后需要使用分号。
if ...:
...
while ...:
...
他们的块也需要缩进一个级别。