Year 8 · Python · Challenge 3

Weekly Weather Report

Use two parallel lists — days and temperatures — to find the hottest and coldest days, the average temperature, and pleasant days.

parallel arraysindexesaveragecount

Scenario: You are a data analyst for a weather station. Daily maximum temperatures for a week are stored in two separate lists: one for the days of the week and another for the temperatures in Celsius.

The arrays are parallel: the first element in days matches the first element in temperatures_celsius, and so on.

Data

days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
temperatures_celsius = [12, 14, 8, 5, 15, 17, 16]

Your tasks

Solve this by iterating through the arrays (do not use sum(), max(), min() or .index()).

  1. Find the hottest and coldest days — keep track of the index of the max and min temperatures so you can print the day name with each temperature.
  2. Calculate the average temperature for the week and print it.
  3. Count pleasant days — a pleasant day is between 10°C and 16°C inclusive. Print the count.
💡 Try the whole challenge in your editor first. Only reveal the solution when you have had a proper go.

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