#             BOOKING MANAGEMENT SYSTEM
# 1. View all Seats
     # seats are from 1 to 50 only

# 2. Booking 
     # On Booking, the seat changes from 1 to B
     # If seat is already booked, then display a message

# 3. Cancellation
    # Change seat number from B to original number

# 4. Exit


print("\n\n\n-----------------------------------------------------------------------------")
print("-------------------------   Welcome to Python Booking System ------------------")

Seats = []
allBookedSeats =[]
check = True
for seat in range(1,51):
    Seats.append(seat)

while check:
    print()
    print("-------------------------------------------------------------------------------")
    print('''\n     Press
           1. View All Seats
           2. Book Your Seat
           3. Cancel your Booking
           4. Exit from System
        ''')
    print("-------------------------------------------------------------------------------")
    choice = int(input("Enter Your choice: "))


    # 1. ------------------------------------ View ALL Seats
    if choice==1:
        
        for seat in Seats:
            print(" ",seat, end=' ')
        print()
            

    # 2. -------------------------------------- Booking Seats
    if choice==2:
        show = 0
        
        # Show All Booked Seats to User
        print()
    
        for book_seat in allBookedSeats:
            print("Seat No.: ",book_seat+1," is Booked" )
            show += 1
        if show==0:
            print("All seats are Empty")
        
        # Booking Seats
        print()
        print("To book Your seat, Enter an Empty Seat Number: ")
        seat_num = int(input())
        if Seats.count(seat_num):
            Seats[seat_num-1] = 'BOOKED'
            allBookedSeats.append(seat_num-1)
            print("Your Seat is Successfully Booked! ")
        else:
            print("Oops! Seat is already Booked")

    # 3. ------------------------------------------ Cancel Booking
    if choice==3:
        cancel_seat = int(input("Enter Seat Number to cancel Your Booking: "))
        if type(Seats[cancel_seat-1])==int:
            print("This seat is already vacant ")
        else:
            Seats[cancel_seat-1] = cancel_seat
            print("Seat is Successfully Cancelled! ")
    
    # 4. ------------------------------------------ Exit    
    if choice==4:
        check = False
   




Leave a comment