In python, I created this simple code:
a = [1, 2, 3, 'hi', 'dog']
for item in a:
if type(item)==str:
a.remove(item)
print(a)
I want the output to be:
[1, 2, 3]
But for some reason the output is showing as:
[1, 2, 3, 'dog']
Can someone please tell me what I am doing wrong?