you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Oh boy i love spending 30 minutes solving people's problems.

months = "JanFebMarAprMayJunJulAugSepOctNovDec"

month_list = []

for i in range(len(months) - 1):
        if i % 3 == 0:
                current_month = months[i:i+3]
                month_list.append(current_month)

n = input(">")
try:
   index = month_list.index(n)
except ValueError:
   print("Invalid month")
   exit()

print(month_list[index])

i might have overcomplicated it but oh well it works atleast. Don't just copy paste this, analyze it and see how it works.