That code should clear list 'bag' out of numbers. but where number follows a number it doesn't work right. For example 8 after 7.
bag = ['apples', 1,'bananas', 'potatoes', 'tomatoes',2, 'chary',3, 'mo4ka', 7,8, 'candies', 'Main_TX']
list_n = []
x = 0
for i in bag:
if isinstance(i, int):
list_n.append(i)
bag.pop(x)
x+=1
print(list_n)
print(bag)
result:
[1, 2, 3, 7]
['apples', 'bananas', 'potatoes', 'tomatoes', 'chary', 'mo4ka', 8, 'candies', 'Main_TX']