ok the guy helpes me with my problem in my last post but I need to switch this:

#This module determines highest value in list
def highestMonthNumber (rainfall):
month = ['January','Febuary','March','April','May','June','July','August'\
,'September','October','November','December']

highestMonthly = 0
for m, n in enumerate(rainfall):
if n > highestMonthly:
highestMonthly = n
highestMonth = m
return month[highestMonth], highestMonthly

to find lowest........

the rest of the code is in my other post including what he fixed for me

You could write it this way

``````MONTH = ['January','Febuary','March','April','May','June','July','August',
'September','October','November','December']

def highestMonth (rainfall):
bestMonth, bestValue = 0, rainfall[0]
for month, value in enumerate(rainfall):
if value > bestValue:
bestMonth, bestValue = month, value
return MONTH[bestMonth], bestValue

def lowestMonth (rainfall):
bestMonth, bestValue = 0, rainfall[0]
for month, value in enumerate(rainfall):
if value < bestValue:
bestMonth, bestValue = month, value
return MONTH[bestMonth], bestValue``````

Note that if you couldn't modify the previous code to find the lowest monthly rainfall, it means that you don't really understand what the code does. If you want to learn python, you must understand what each of these lines of code does exactly. You could add print statements to display the values of the variables, etc.

Lists have min and max functions which could also be used. For both code solutions, what happens if there is more than one month with the same rainfall?

``````def lowest_month (rainfall):
lowest = min(rainfall)
return MONTH[rainfall.index(lowest)], lowest``````