Exercise 1 solution from datetime import datetime def readings(text): found = set() for f in ("%d/%m/%Y", "%m/%d/%Y"): try: found.add(datetime.strptime(text, f).date()) except ValueError: pass return sorted(found) for t in ["03/04/2026", "13/04/2026", "05/05/2026", "31/02/2026"]: r = readings(t) verdict = "ambiguous" if len(r) > 1 else ("clear" if r else "invalid") print(t, [d.isoformat() for d in r], verdict) Output (run, and exactly as shown): 03/04/2026 ['2026-03-04', '2026-04-03'] ambiguous 13/04/2026 ['2026-04-13'] clear 05/05/2026 ['2026-05-05'] clear 31/02/2026 [] invalid Explanation: a set holds each distinct date once, so a text that reads the same both ways (05/05/2026) collapses to one date and is safe even though it fits both formats. Only when two different dates come out is the text truly ambiguous. 13/04/2026 has only one reading because there is no month 13, and 31/02/2026 fits neither because February never has 31 days.