Okay i'm probably majorly over thinking this but i need to create a counter that counts how many weeks a certain value gets exceeded, except i honestly don't know how to do it. I thought of find the end max value and taking it away from the first max value except i can't get the last max value. here's some of my code:

i = 1

maxindividuals=0

while i < nstep:

thisTime = i * StepSize

Snew = SArray* + ((Sdash(S,I,N,a)) * StepSize)
Inew = IArray + ((Idash(S,I,N,a,b,c)) * StepSize)
Rnew = RArray + ((Rdash(I,b)) * StepSize)
Dnew = DArray + ((Ddash(I,c)) * StepSize)
S = Snew
I = Inew
D = Dnew
R = Rnew
if I > maxindividuals:
maxindividuals=I
timemaxindividuals=thisTime +0.1
SArray = S
IArray = I
RArray = R
DArray = D
TimeArray = thisTime
i = i + 1*

any help will be greatly greatly appreciated as i've been sitting here for a while trying to figure it out.