Here is the code I tried:
def filter_list(lst):
for l in lst:
print(l)
if isinstance(l, str):
lst.remove(l)
return lst
print(filter_list([1, 2, "aasf", "1", "123", 123]))
I recieved following output:
C:\Users\acain\PycharmProjects\gfn\venv\Scripts\python.exe C:/Users/acain/PycharmProjects/gfn/experiment.py
1
2
aasf
123
[1, 2, '1', 123]
Process finished with exit code 0
I can't understand why strings "1" and "123" are not printed. Please help me.