Below is the list where I want to separate string and integers.
This list gives me correct result:
list_a = ["Michell",123,"Apple","Food",456,"Another"]
list_e = []
x = 0
for item in list_a:
print("x is: ", x)
print("item is: ", item)
if isinstance(item,int):
list_e.append(item)
list_a.pop(x)
x+=1
print(list_a)
print(list_e)
The Problem starts when I add an element to list like below: Added an element 3231 after 456...
>>> list_a = ["Michell",123,"Apple","Food",456,3231,"Another"]
...
['Michell', 'Apple', 'Food', 3231, 'Another']
[123, 456]
What is the problem here?