So I have the following code
n = int(input())
arr = map(int, input().split())
numList = list(arr)
topNum = max(numList)
for i in numList:
if i == topNum:
del numList[numList.index(i)]
print(numList)
It takes the following input
5
2 3 6 6 5
and the idea is to remove all occurrences of the top number, but I have a bug where it removes the top number only once. I have checked to print the number if it equals the top number, and it printed twice when testing this so I know it has nothing to do with the if statement and the for loop, so it must have something to do with the way I am deleting it? If so why does it only delete once despite being in a for loop. I understand that its meant to only delete the first occurrence but that's why I have the for loop.