Editor

The Coldest Day

#555 · Lists · Beginner · Find and fix · 30 XP · about 4 min

A weather station records one temperature per day. coldest_day(temps) should return the day number of the lowest temperature, counting the first day as day 1. If two days tie for the lowest, return the earlier day.

The code in the editor has a bug. It works in winter, but for summer readings such as [21, 18, 25] it returns 0, and there is no day 0.

Examples

coldest_day([3, -2, 5])    # returns 2
coldest_day([21, 18, 25])  # returns 2
coldest_day([4, 4, 9])     # returns 1

Note

The list always has at least one temperature.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.