Question for you all. I'm coding an assignment for school in which I have to simulate a physical process of water flowing between three ponds, and how a pollutant dumped into pond 1 flows between the ponds. I keep getting the error "IndexError: list index out of range". I have tinkered around with different things all day but cannot get the error to go away.

Here is my code below: (fyi python says I have an error on line 49, 32, and 38).

``POND_1 = [0]POND_2 = [0]POND_3 = [0]# POND 1def pond1(timeInput):pollutants = Inflow3(timeInput-1)-Outflow2(timeInput-1)+POND_1[timeInput-1]total = leakingInput*timeInputif total <= maximumInput:pollutants += leakingInputreturn pollutantsdef Inflow3(timeInput):return 0.005*POND_3[timeInput]def Outflow2(timeInput):return 0.005*POND_1[timeInput]#POND 2def pond2(timeInput):return Inflow1(timeInput-1)-Outflow3(timeInput-1)+POND_2[timeInput-1]def Inflow1(timeInput):return 0.005*POND_1[timeInput]def Outflow3(timeInput):return 0.005*POND_2[timeInput]#POND 3def pond3(timeInput):return Inflow2(timeInput-1)-Outflow1(timeInput-1)+POND_3[timeInput-1]def Inflow2(timeInput):return 0.005*POND_2[timeInput]def Outflow1(timeUnput):return 0.005*POND_3[timeInput]# User InputmaximumInput = int(input("Please enter the maximum amount of pollutant: "))leakingInput = float(input("Please enter the rate in which the pollutant is leaking: "))timeInput = int(input("Please enter the amount of time you would like the simulation to run in minutes: "))# Amount of Pollutant in Pond every hour calculationfor n in range(0, timeInput+1):POND_1.append(pond1(n))POND_2.append(pond2(n))POND_3.append(pond3(n))if n % 60 == 0:print("The amount of pollutant in Pond 1 is: ", POND_1[n])print("The amount of pollutant in Pond 2 is: ", POND_2[n])print("The amount of pollutant in Pond 3 is: ", POND_3[n])if n == timeInput:print("Final number of pollutants in Pond 1", POND_1[timeInput])print("Final number of pollutants in Pond 2", POND_2[timeInput])print("Final number of pollutants in Pond 3", POND_3[timeInput])``

It's a typo:

``````def Outflow1(timeUnput):
``````

has to be:

``````def Outflow1(timeInput):
``````

Top