Running a previous line?
<p>i have a while true so that if there is not enough seats on the plane you can't book a flight, but i want to go back to a previous line of code (line 8) because when i do this:</p>

<pre><code>while True:
    if b == maxpass and booking == "b" or booking == "book":
        print ("Sorry but the flight you want is currently fully booked. Sorry for Inconviniance")

        print ("Welcome to Flight Booking Program")
        print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
        flight = input()
</code></pre>

<p>It keeps repeating.</p>

<p>Here is the rest of the code:</p>

<pre><code># b means bookings, fn means Flight Number
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 flight == fn:
            print ("There are currently", seatsremain, "seats remaining")
            break
        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()

    print ("Would you like to book or cancel your flight?")
    booking = input().lower()        

    while True:
        if b == maxpass and booking == "b" or booking == "book":
            print ("Sorry but the flight you want is currently fully booked. Sorry for Inconviniance")

            print ("Welcome to Flight Booking Program")
            print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
            flight = input() 


        else:
            break

    if booking == "c" or booking == "b" or booking == "book" or booking == "cancel":
        if booking == "b" or booking == "book":
            print ("How many seats are you booking?")
            while True:
                try:
                    amount = int(input())
                    if amount &lt;1 or amount &gt;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 ("How many seats are you booking?")
                    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!")

        else:
            if booking == "c" or booking == "cancel":
                print ("How many seats are you canceling?")
                while True:
                    try:
                        amount = int(input())
                        if amount &lt;1 or amount &gt;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 ("How many seats are you cancelling?")
                        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
                    except ValueError:
                        print ("You must enter a valid number!")
    else:
        print ("Error")
        print ("Please only type book or cancel")


print("There are", b, "people booked on flight", fn)
</code></pre>

<p>It's not 100% clear what you are asking, but I suspect you want something like this:</p>

<pre><code>class MyOwnError(Exception):
    def __init__(self, message):
        self.message = message
    def __str__(self):
        return repr(self.message)

while flight != "X":
    try:
        seatsremain = 68 - b


        if flight == fn:
            print ("There are currently", seatsremain, "seats remaining")
        else:
            raise MyOwnError("Not a valid flight number!")

        # etc...
                    if amount &lt;1 or amount &gt;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 ("How many seats are you cancelling?")
                    else:
                        b = b - amount
                        raise MyOwnError("Your flight has been Cancelled!")
        # etc...

    except MyOwnError as e:
        print (e.message)
        print ("Welcome to Flight Booking Program")
        print ("Please enter the flight number you want to book/cancel with? (Case Sensitve)")
        flight = input()
</code></pre>

<p>Here the exceptions force jumps out of all the loops, and can re-prompt for the input. You can expand this idea to handle the seat cancellation loop too, by using nested <code>try</code>/<code>except</code> statements.</p>

python