I am trying to display the name of a month, so my list has 12 variables for each month of the year. In my example,
highPosX = 4 so why does
print(month[highPosX]) not print the 4th element and give the error
IndexError: list index out of range? The rest of the code works as intended.
eBill =  month = ['January ', 'February ', 'March ', 'April ', 'May ', 'June ', 'July ', 'August ', 'September ', 'October ', 'November ', 'December '] total = 0 for i in range(0,12): cycle = int(input("Enter a number " +str(month.pop(0)))) total = total + int(cycle) eBill.append(cycle) avg = (total/12) high = max(eBill) highPos = ([index for index, item in enumerate(eBill) if item == high]) highPosX = highPos highMonth = month[highPosX] print(highMonth)