It is a correct python code

today_day = 11
today_month = 9
today_year = 2023

birth_day = int(input("Enter your birth day (1-31): "))
birth_month = int(input("Enter your birth month (1-12): "))
birth_year = int(input("Enter your birth year (e.g., 2001): "))

age_year = today_year - birth_year

if today_month < birth_month or (today_month == birth_month and today_day < birth_day):
    age_year -= 1  # Corrected the calculation of age_year
age_month = today_month - birth_month

if today_day < birth_day:
    age_month -= 1
    today_month -= 1
    today_day += 30  # Corrected this line to add 30 days
age_day = today_day - birth_day

print(f"You are {age_year} years, {age_month} months, {age_day} days old.")

Can you please rephrase your question and explain what it has to do with all these tags you added?
image

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.