Output error in use of conditionals.....help!


for i in list_d:
... if isinstance(i,int):
... list_e.append(i)
... list_d.pop(x)
... x+=1
>>> list_d
['john', 'got', 456]
>>> list_e
[223, 456]


What's the issue? If the code is something others should look at then make sure it's intact.

Whoever is going to make an attempt at answering your post will need to understand the situation first! That's really difficult right now.

Perhaps you should create a minimal version of the issue, there's a lot more code than just if-statements (which is going to distract from what you want help with)


The problem is with the output... When I am saying append in list_e... I should get only integers, list_e = [223,456]
& when I say pop in list_d....it should eliminate integers & keep only strings...hence my list_d=[ "Justin", " john", "got"].....
This is the problem....I am not able to find the possible cause for this


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.