I have:
*MONTHS = ("January", "February", "March", ... "December") (all months included)
I'm supposed to input the 3 letter abbreviation for a month and get the index value for the month. So far, I have:
for M in MONTHS:
shortMonths = M[0:3]
print shortMonths
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
I noticed that the output months in shortMonths do not have quotation marks, which is making it impossible to test if an abbreviation is in shortMonths:
MMM = "Feb"
print list(shortMonths).index(MMM) + 1 # taking into consideration that the first month of the list, January, is month 0+1 = 1 and so on for all months
ValueError: 'Feb' is not in list
How can I fix this without creating a function? Also, this is an assignment question. And, we're not allowed to use dictionaries or maps or datetime
print 'hi'in your interpreter and the Mystery of the Missing Quotation Marks may become solved.the Mystery of the Missing Quotation Marksis cool :)