PS Use python for everyone2e book and use nested loop and ma
PS- Use python for everyone2/e book and use nested loop and make a simple program and type the coding in python and not in java
A theater seating chart is implemented as a table of ticket prices, like this CI C2 C3 C4 C5 C6 C7 C8 C9 C10 RI 10 10 10 10 10 10 10 10 10 10 R2 100 10 10 10 10 10 10 10 10 10 R3 10 10 10 10 10 10 10 10 10 10 R4 100 10 20 20 20 20 20 20 10 10 RS 10 10 20 20 20 20 20 20 10 10 R6 100 10 20 20 20 20 20 20 10 10 R7 20 20 30 30 30 30 30 30 20 20 R8 20 30 30 40 150 50 40 30 30 20 R9 30 40 50 50 150 50 50 50 40 30 R 10 20 40 30 50 50 50 50 50 A0 20 A theater seating chart is implemented as a table of ticket prices, like this above Write a program that asks users to pick either a seat or a price. When choosing seat, indicate the row and column for the location; when choosing the price, like computer find the first available price; mark the sold seats by changing the price to 0. When a user specifies a seat, make sure it is available. Use loop to determine whether continue to order or not. In each seating chart should be displayed for user. When user stops ordering, your program should output the number of tickets ordered, and amount ordered. PS- the program is being written in python language and our insturctor has told us to us elifSolution
Please run it in python 3 or above
#take input from user
r,c=10,10 #row and column
matrix = [[0 for x in range(r)] for y in range(c)] #empty matrix
#take seat pricing from user
for i in range(r):
for j in range(c):
matrix[i][j]=int(input(\"Please enter pricing for Row: \"+str(i+1)+\" and column: \"+str(j+1)+\": \"))
#print the matrix now
print(\"Available Seats: \")
for i in range(r):
for j in range(c):
print(str(matrix[i][j])+\"\\t\")
print(\"\ \")
amount=0
num=0
while(1):
try:
row=int(input(\"Enter row number to book: \"))
col=int(input(\"Enter column number to book: \"))
if(matrix[row-1][col-1]!=0):
amount+=matrix[row-1][col-1]
matrix[row-1][col-1]=0
print(\"Booked successfully.\")
num+=1
ch=str(input(\"Would you like to order more? y/n: \"))
if(ch==\"n\"):
break
else:
print(\"This seat is already booked, please try another seat.\")
except IndexError:
print(\"Please enter correct seat number.\")
print(\"Number of tickers ordered: \"+str(num))
print(\"Your total amount is: \"+str(amount))
