from datetime import date class Person: def __init__(self, name, birth_date): self.name = name if isinstance(birth_date, date): self.birth_date = birth_date elif isinstance(birth_date, str): self.birth_date = date.fromisoformat(birth_date) else: raise ValueError(f"unsupported date format: {birth_date}") jane = Person("Jane Doe", "2000-11-29") print(jane.birth_date) john = Person("John Doe", date(1998, 5, 15)) print(john.birth_date) linda = Person("Linda Smith", 1011222000)