Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. def main():
  2. seatList = [
  3. [50,50,50,50,50],
  4. [40,45,45,45,40],
  5. [30,35,35,35,30],
  6. [20,20,20,20,20],
  7. [10,10,10,10,10],
  8. ]
  9. cont = "y"
  10. while cont.lower() == "y":
  11. print("Here is the seating arrangement:")
  12. availableSeat = seatPrinter(seatList)
  13. totalRow = int(len(seatList)) - 1
  14. totalColumn = int(len(seatList[0])) - 1
  15. seatRow = int(input("Please enter a row number (1 to %d):"%totalRow))
  16. seatColumn = int(input("Please enter a seat number (1 to %d):"%totalColumn))
  17. seatStatus = seatAvailable(seatList, seatRow, seatColumn)
  18. cont = input("Would you like to reserve another seat?(Y/N)")
  19.  
  20. def seatPrinter(seats):
  21. for i in range(len(seats[0])):
  22. print(seats[i])
  23.  
  24. def seatAvailable(seats, row, column):
  25. for i in range(len(seats)):
  26. for j in range(len(seats)):
  27. if seats[i][j] is not 'SS':
  28. seats[i][j] = 'SS'
  29. print("Your seat is in row %d seat number %d"%(i+1, j+1))
  30. return
  31. else:
  32. print("Sorry, that seat isn't available.")
  33. return
  34.  
  35. main()
  36.  
  37. Here is the seating arrangement:
  38. [50, 50, 50, 50, 50]
  39. [40, 45, 45, 45, 40]
  40. [30, 35, 35, 35, 30]
  41. [20, 20, 20, 20, 20]
  42. [10, 10, 10, 10, 10]
  43. Please enter a row number (1 to 4):1
  44. Please enter a seat number (1 to 4):1
  45. Your seat is in row 1 seat number 1
  46. Would you like to reserve another seat?(Y/N)y
  47. Here is the seating arrangement:
  48. ['SS', 50, 50, 50, 50]
  49. [40, 45, 45, 45, 40]
  50. [30, 35, 35, 35, 30]
  51. [20, 20, 20, 20, 20]
  52. [10, 10, 10, 10, 10]
  53. Please enter a row number (1 to 4):1
  54. Please enter a seat number (1 to 4):2
  55. Sorry, that seat isn't available.
  56. Would you like to reserve another seat?(Y/N)
Add Comment
Please, Sign In to add comment