I am a young student, and I'm wanting to learn coding. However, my if function is causing an issue and I'm not sure as to why. I'm sorry if anything is hard to understand or if my code is over-complicated; I'm not sure how to make it quicker.
As one of my first experiences with coding, I tried to create a basic bit of code, saying how old the user is in years, months, and days, based on their inputs. This had worked, however, if I input the month as 2, while the current month as 1, it would become a negative number. To try and stop this, I added an "if" function. This isn't working and I'm not sure as to why.
from time import localtime
year = localtime().tm_year
month = localtime().tm_mon
day = localtime().tm_mday
print("What day, month, and year were you born?")
day_input = int(input())
month_input = int(input())
year_input = int(input())
year_output = year - year_input
month_output = month - month_input
day_output = day - day_input
if month_input>month and month == "1" or month_input>month and month == "3" or month_input>month and month == "5" or month_input>month and month == "7" or month_input>month and month == "8" or month_input>month and month == "10" or month_input>month and month == "12":
month_output = 12-month
day_output = 31-1
year_output = year-year_input-1
if month_input>month and month == "2":
month_output = 12-month
day_output = 28-1
year_output = year-year_input-1
if month_input>month and month == "4" or month_input>month and month == "6" or month_input>month and month == "9" or month_input>month and month == "11":
month_output = 12-month
day_output = 30-1
year_output = year-year_input-1
print("You are", year_output, "years,", month_output, "months, and", day_output, "days old!")