-1

a and b are lists of numbers and there are duplicates. b is a subset of a.

For example:

a = [1, 1, 1, 2, 2, 3]
b = [1, 1, 2]

I'm working on a function to get the rest of a after deleting the numbers in b:

>>> func(a, b)
[1, 2, 3]

I know it can be achived by enumerating through the list, but is there an easier way to get the result?

sty331
  • 1
  • 2

1 Answers1

-3

If you like to remove duplicates, just convert to to set:

nodups = set(a)

if you like it in LIST:

nodups = list(set(a))

Avner Cohen
  • 80
  • 1
  • 5