Months

In [5]:
def main():
    months = "JanFebMarAprMayJunJulAugSepOctNovDec"
    
    n = eval(input("Enter a month number (1-12):"))
    
    pos = (n - 1) * 3
    print(n, pos, pos+3)
    month_abbrev = months[pos:pos+3]
    print("The month abreviation is " + month_abbrev + ".")
In [4]:
main()
Enter a month number (1-12):7
7 18 21
The month abreviation is Jul.
In [ ]: