I need to count again whenever there is a bigger number on the list. But I don't know how to deal with the IndexError and why it happened.
for i in range(len(left_days)):
largest = left_days[0]
count = 1
del left_days[0]
if(left_days[i]<=largest):
count+= 1
del left_days[i]
if i == len(left_days)-1:
answer.append(count)
i = 0
else left_days[i]>largest:
answer.append(count)
This is the error.
File "/solution_test.py", line 18, in test
actual0 = solution(p0_0,p0_1)
File "/solution.py", line 24, in solution
if(left_days[i]<=largest):
IndexError: list index out of range```