Year 9 · Python · Challenge 4

Delivery Distances

Four delivery vans and three weekdays of kilometre data — count long trips and analyse rows and columns.

2D arraycounttotalaveragemax / min

Scenario: A small fleet of delivery vans stores distances in a 2D array. Each row is a van and each column is a day: Monday, Wednesday and Friday (kilometres).

Data

delivery_distances = [
    # Mon, Wed, Fri
    [120, 85, 150],  # Van 1
    [95, 110, 95],   # Van 2
    [145, 130, 160], # Van 3
    [80, 75, 90]     # Van 4
]

Your tasks

  1. Counting — count how many daily trips in the whole fleet were 100 km or longer.
  2. Totalling — calculate and print the total distance traveled by Van 2 (row index 1).
  3. Averaging — calculate the average delivery distance on Wednesday (column index 1).
  4. Maximum and minimum — find the longest single trip on Friday (column 2) and the shortest single trip on Monday (column 0).
💡 Try every task in your editor first. Only reveal the solution when you have had a proper go.

Previous: Challenge 3 · Year 9 Python