Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- seatList = [
- [50,50,50,50,50],
- [40,45,45,45,40],
- [30,35,35,35,30],
- [20,20,20,20,20],
- [10,10,10,10,10],
- ]
- cont = "y"
- while cont.lower() == "y":
- print("Here is the seating arrangement:")
- availableSeat = seatPrinter(seatList)
- totalRow = int(len(seatList)) - 1
- totalColumn = int(len(seatList[0])) - 1
- seatRow = int(input("Please enter a row number (1 to %d):"%totalRow))
- seatColumn = int(input("Please enter a seat number (1 to %d):"%totalColumn))
- seatStatus = seatAvailable(seatList, seatRow, seatColumn)
- cont = input("Would you like to reserve another seat?(Y/N)")
- def seatPrinter(seats):
- for i in range(len(seats[0])):
- print(seats[i])
- def seatAvailable(seats, row, column):
- for i in range(len(seats)):
- for j in range(len(seats)):
- if seats[i][j] is not 'SS':
- seats[i][j] = 'SS'
- print("Your seat is in row %d seat number %d"%(i+1, j+1))
- return
- else:
- print("Sorry, that seat isn't available.")
- return
- main()
- Here is the seating arrangement:
- [50, 50, 50, 50, 50]
- [40, 45, 45, 45, 40]
- [30, 35, 35, 35, 30]
- [20, 20, 20, 20, 20]
- [10, 10, 10, 10, 10]
- Please enter a row number (1 to 4):1
- Please enter a seat number (1 to 4):1
- Your seat is in row 1 seat number 1
- Would you like to reserve another seat?(Y/N)y
- Here is the seating arrangement:
- ['SS', 50, 50, 50, 50]
- [40, 45, 45, 45, 40]
- [30, 35, 35, 35, 30]
- [20, 20, 20, 20, 20]
- [10, 10, 10, 10, 10]
- Please enter a row number (1 to 4):1
- Please enter a seat number (1 to 4):2
- Sorry, that seat isn't available.
- Would you like to reserve another seat?(Y/N)
Add Comment
Please, Sign In to add comment