Exact Age, Including Leap Days

medium
Unit 18 · Datetime II0/1 to milestone

Implement age(birth, on) returning a person's age in completed years on date on (both ISO strings). People born on 29 February have their birthday on 1 March in non-leap years.

Also implement next_birthday(birth, on) returning the ISO date of their next birthday strictly after on, using the same rule.

#datetime#edge-cases2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Exact Age, Including Leap Days · TechGradify