Suppose we have a list, where every item has its frequency: 1, 2, 3 , etc. Then, from this list, I would like to get another list where every item has a frequency 1.
For example, the original list is:
A = [1, 2, 3, 1, 2, 5, 6, 7, 8, 5]
The idea is to get another list such as:
B = [1, 2, 3, 5, 6, 7, 8]
How can I do it?
This is what I implemented in Python:
for i in range(10):
k = i
item1 = A[k]
for j in range(k):
l = j
item2 = A[l]
if (item1 != item2):
B.append(item1)
break
But I get:
B = [1, 2, 5]
Can someone please help me? Thanks in advance.