from datetime import date
def calculate_age(birth_year, birth_month):
today = date.today()
age = today.year - birth_year
if today.month < birth_month:
age -= 1
return age
birth_year = int(input("Digite o ano em que você nasceu: "))
birth_month = int(input("Digite o mês em que você nasceu (1-12): "))
if birth_month < 1 or birth_month > 12:
print("Mês inválido. Por favor, insira um número entre 1 e 12.")
exit()
print(f"Você tem {calculate_age(birth_year, birth_month)} anos.")