I am attempting to remove duplicates from a list of numbers; however, the code doesn't remove all the duplicates. After debugging, I realized that an integer is skipped if the previous iteration results in the removal of that integer (neither of the 2's in the list are removed as they are preceded by 5 which was a duplicate):
numbers_list = [5, 2, 546, 7, 3, 5, 2, 7, 29, 6, 5, 7]
for item in numbers_list:
if numbers_list.count(item) > 1:
numbers_list.remove(item)
else:
pass
print(numbers_list)
EDIT: I know there are other ways to remove duplicates from a list but I want to know how to ensure that iterations aren't skipped.