The program I have is rather complicated so I've just decided to take this portion.
Basically, this code is supposed to loop through a series of lines and stop once TIME
has reached 4800; however, if quepax
has reached 15 in a loop, it will evaluate R
. If the loop is not yet broken by TIME>=4800
, subsequent loops will not get new values of R
(since quepax
will always be more than 15 from there) while still going through the rest of the lines. Below is an attempt to do such a program. It sort of works, but is it possible to make a simpler code without repeating content?
while True:
i+=1
pax[i]=random.randint(1,5)
TOTALPAX+=pax[i]
TIME+=between[i]
queue+=pax[i]
if quepax>15:
R=i-1
while True:
i+=1
pax[i]=random.randint(1,5)
TOTALPAX+=pax[i]
TIME+=between[i]
queue+=pax[i]
if TIME>=4800:
break
if TIME>=4800:
break