Please write a function that sums a list, but ignores any duplicate items in the list.

For instance, for the list [3, 4, 3, 6] , the function should return 10.

Difficulty: introductory

Starter code:

def sum_no_duplicates(l):
	

Solutions:
from collections import Counter


def sum_no_duplicates(nums):
    return sum(k for k, v in list(Counter(nums).items()) if v == 1)


def sum_no_duplicates(l):
    return sum(n for n in set(l) if l.count(n) == 1)

from collections import Counter

def sum_no_duplicates(l):
    return sum(k for k,v in list(Counter(l).items()) if v == 1)


def sum_no_duplicates(l):
    return sum([e for e in l if l.count(e)==1])


from collections import Counter

def sum_no_duplicates(xs):
    return sum(x for x, c in Counter(xs).items() if c == 1)

sum_no_duplicates = lambda L: sum( [n for n in L if L.count(n) == 1] )

def sum_no_duplicates(l):
    return sum([n for n in l if l.count(n) == 1])


def sum_no_duplicates(arr):
    return sum(i for i in set(arr) if arr.count(i) == 1)


from collections import Counter

def sum_no_duplicates(l):
    c = Counter(l)
    return sum(k for k,v in c.items() if v == 1)

def sum_no_duplicates(l):
    return sum(x for x in set(l) if l.count(x) < 2)