You ca do it with a one-liner. Try
tin = ([1, 5], [7, 8, 3, 2], [3, 3, 2])
print(sum ({x for l in tin for x in l}))
Explanation: a
set comprehension is used to extract all the unique numbers of
tin
into a set (because
sets don't store duplicate values). Eventually all the set items are summed up using the
sum
function.