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): "))
上面的代码在单词while的第6行有语法错误
下一行缺少括号/括号。添加括号,错误应该消失。
hour = float(input("Enter total hour at parking deck: ")
此外,if是否需要在最后加一个冒号。以下是更正的行
if ticket in ['No','no','N','n']:
hour = float(input("Enter total hour at parking deck: "))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句