I'm running this code and for some reason it is only popping 1 element when there are 2 elements in the array that should be hitting the "if not inc" statement.
I've used prints to debug and it seems that the loop is breaking after the "if not inc" == true the first time and I do not want that to happen. It should continue in the loop and get back there a second time.
Have tried pass AND continue still no desired outcome
def readFile():
with open('incidents.txt') as f:
x = f.read().splitlines()
print(x)
i = 0
for inc in x:
print(i)
if not inc:
x.pop(i)
print("if command")
pass
i = i + 1
print(x)
y = x
return y
Original Array -
['INC123123123', 'INC222222222', 'INC333333333', 'INC444444444', 'INC555555555', '', '']
Expected result is -
['INC123123123', 'INC222222222', 'INC333333333', 'INC444444444', 'INC555555555']
Actual Result is -
['INC123123123', 'INC222222222', 'INC333333333', 'INC444444444', 'INC555555555', '']