When I run this code, it works, but for some reason it only removes the 'p' and 'h' strings and not the 'z' string. Why?
def filter_list(l):
for item in l:
if item == str(item):
l.remove(item)
return l
print(filter_list([1, 9, 3, 'p', 'z', 7, 'h']))
output:[1, 9, 3, 'z', 7]