Editor

The Oldest Member

#230 · Working with data · Beginner · 30 XP · about 5 min

A club keeps its members as dictionaries with a 'name' and a 'born' date, written as a string 'YYYY-MM-DD': a four-digit year, then a two-digit month and day, as in '1987-03-09'. A member whose birth date is not known has 'born': ''.

Write oldest(members) that returns the name of the oldest member, the one with the earliest birth date. Skip members whose date is not known. If several members share the earliest date, return the one listed first.

Examples

oldest([
    {'name': 'Ana', 'born': '1990-05-17'},
    {'name': 'Ben', 'born': '1985-11-02'},
    {'name': 'Cy', 'born': '1985-12-01'},
])  # returns 'Ben'
oldest([{'name': 'Gus', 'born': ''}, {'name': 'Hal', 'born': '2010-02-14'}])  # returns 'Hal'

Constraints

  • members has up to 1,000 members, and at least one of them has a known birth date.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.