guys i'm trying to do this program where i have to take a list and separate all the non unique elements and put it in a list without the changing the order of it.
So for this, I did the program in python and put some flags to help me know where i'm doing wrong.So in the program i tried to reset the list3 value( after deleting an element of it inside a loop and exiting it) but it wouldn't let me do it.so any help would be greatly appreciated. Thank you guys very much.
for x in range(0,l):
list3=list1 # I used this to reset the list3 to list1 and use it in the loop but it wouldn't reset
print('this is the reset of list 3',list3)
print('this is list2: ',list2)
# my results were
this is the reset of list 3 [1, 2, 3, 1, 3]
while loop 2
while loop 3
while loop 1
this is list2: 
this is the reset of list 3 [2, 3, 1, 3]
IndexError: list index out of range
Does this do what you want?
#list1=[5,5,5,5,5] list1=[1,2,3,1,3] #list1=[1,2,3,4,5] list2= for num in list1: if list1.count(num) > 1: list2.append(num) print(list2)