Define a list with the 12 months as elements, i.e. myList = [“January” , “February”, …], loop through the list and display the following using the indices and the elements:

 

 

 

myList = ["January", "February", "March", "April", "May", "June",

          "July", "August", "September", "October", "November", "December"]

 

 

for index, month in enumerate(myList):

  print(f"{month} is the #{index + 1} month in a year")

 

January is the #1 month in a year

February is the #2 month in a year

March is the #3 month in a year

April is the #4 month in a year

May is the #5 month in a year

June is the #6 month in a year

July is the #7 month in a year

August is the #8 month in a year

September is the #9 month in a year

October is the #10 month in a year

November is the #11 month in a year

December is the #12 month in a year

 

Go Back