Year 9 · Python · Challenge 3

Cinema Seat Bookings

A boutique cinema grid where 0 means empty and a positive number is the ticket price paid for a booked seat.

2D arraycountrow totalscolumn averagemax / min

Scenario: A small cinema has 4 rows of 5 seats. In seating_chart, 0 means empty and a positive number is the price paid (in dollars) for a booked seat.

Data

seating_chart = [
    # Seat 1, Seat 2, Seat 3, Seat 4, Seat 5
    [12, 0, 12, 15, 0],   # Row 1 (Front)
    [15, 15, 0, 15, 15],  # Row 2
    [18, 18, 18, 18, 18], # Row 3
    [0, 20, 20, 0, 20]    # Row 4 (Back)
]

Your tasks

  1. Counting — count the total number of booked seats (value greater than 0) in the whole cinema.
  2. Totalling by row — for each row, print that row’s sales revenue.
  3. Averaging a column — average price for Seat 3 (column index 2), only counting booked seats (price > 0).
  4. Maximum and minimum — find the most expensive ticket and the cheapest booked ticket (ignore empty seats valued 0).
💡 Try every task in your editor first. Only reveal the solution when you have had a proper go.

Previous: Challenge 2 · Year 9 Python · Next: Challenge 4