-2
这是我正在做的一件事,在最后一行当我运行我的程序时,它说意外的无意识。我不明白。帮帮我。我正在为课程做一个项目,我无法理解为什么最后一行被忽略掉?
b = 0
maxpass = 68
minpass = 0
fn = "FNO123"
amount = 0
seatsremain = 68 - b
print ("Welcome to Flight Booking Program")
print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
flight = input()
while flight != "X":
seatsremain = 68 - b
while True:
if b >= minpass and b <= maxpass:
break
else:
print ("Sorry but the flight you want is currently fully booked. Sorry for Inconviniance")
if flight == fn:
print ("There are currently", seatsremain, "seats remaining")
print ("Would you like to book or cancel your flight?")
booking = input().lower()
else:
print ("ERROR")
print ("Not a valid flight number! Remember input is CASE SENSITIVE")
print ("Welcome to Flight Booking Program")
print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
flight = input()
while True:
if booking == "c" or booking == "cancel" or booking == "b" or booking == "book":
break
else:
print ("ERROR")
print ("You must cancel at least 1 seat and not exceed the minimum amount of seats avaliable")
print ("There are currently", seatsremain, "seats remaining")
print ("Would you like to book or cancel your flight?")
if booking == "b" or booking == "book":
print ("How many seats are you booking?")
while True:
try:
amount = int(input())
if amount <1 or amount >seatsremain:
print ("ERROR")
print ("You must book at least 1 seat and not exceed the maximum amount of seats avaliable")
print ("There are currently", seatsremain, "seats remaining")
print ("Would you like to book or cancel your flight?")
else:
b = b + amount
print ("Your flight has been Booked!")
print ("Welcome to Flight Booking Program")
print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
flight = input()
break
except ValueError:
print ("You must enter a valid number!")
elif booking == "c" or "cancel":
print ("How many seats are you canceling?")
while True:
try:
amount = int(input())
if amount <1 or amount >b:
print ("ERROR")
print ("You must cancel at least 1 seat and not exceed the minimum amount of seats avaliable")
print ("There are currently", seatsremain, "seats remaining")
print ("Would you like to book or cancel your flight?")
else:
b = b - amount
print ("Your flight has been Cancelled!")
print ("Welcome to Flight Booking Program")
print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
flight = input()
break
print("There are", b, "people booked on flight", fn)
请不要添加乱码来克服限制。如果您的帖子不符合要求,那么您的帖子肯定存在问题。请参见[问]和[mcve] –
只适用于样式...'print'是一个函数。这样你应该写'print(something)'而不是'print(something)'(打印后有空格)。 – pepr