ip=['a',1,2,3] m=[] n=[] for x in range(0,len(ip): if str(ip[x]).isdigit(): m.append(ip[x]) else:n.append(ip[x]) print(m,n)
Here is what the above code is Doing:
1. It is creating two empty lists m and n.
2. It is iterating over the list ip.
3. If the element is a digit, it is appended to the list m.
4. If the element is not a digit, it is appended to the list n.
5. Finally, it prints the lists m and n.