<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
<What do you expect to happen instead?>
It is an age calculator, which works fine (well sometimes) and it also passed, but is there a way to reduce its size and make it work more often with the stuff i have learned up to this point?
m = [“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”]
t =
Year = int(raw_input(“In what year were you born? (numbers only)”))
Month = raw_input(“In what month were you born? (captitalize first letter)”)
Day = int(raw_input(“In what day were you born? (numbers only)”))
current_year = int(raw_input(“What is the current year? (numbers only)”))
current_month = raw_input(“What month are we in? (capitalize first letter)”)
current_day = int(raw_input(“What is the current Day? (numbers only)”))
if current_month == “January”:
t.append(m[1])
t.append(m[2])
t.append(m[3])
t.append(m[4])
t.append(m[5])
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “February”:
t.append(m[2])
t.append(m[3])
t.append(m[4])
t.append(m[5])
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “March”:
t.append(m[3])
t.append(m[4])
t.append(m[5])
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “April”:
t.append(m[4])
t.append(m[5])
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “May”:
t.append(m[5])
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “June”:
t.append(m[6])
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “July”:
t.append(m[7])
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “August”:
t.append(m[8])
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “Spetember”:
t.append(m[9])
t.append(m[10])
t.append(m[11])
elif current_month == “October”:
t.append(m[10])
t.append(m[11])
elif current_month == “November”:
t.append(m[11])
def age(x, Month, z):
a = current_year - x
if Month == current_month and z > current_day:
a-=1
print "You are ", a,"Years old."
elif Month == current_month or Month == t[0] or Month == t[1] or Month == t[2] or Month == t[3] or Month == t[4] or Month == t[5] or Month == t[6] or Month == t[7] or Month == t[8] or Month == t[9] or Month == t[10] or Month == t[11]:
a-=1
print "You are ", a, "years old."
else:
print "You are ", a, "years old."
for i in range(1):
i = raw_input("is this correct? (yes or no)")
if i == "yes":
print "I'm always right!"
elif i == "no":
print "Impossible! Trust me, I'm way smarter than you!"
else:
print "Wow are you too scared to admit how awesome I am?"
age(Year, Month, Day)
<do not remove the three backticks above>