'''有一个列表[3,4,1,2,5,6,6,5,4,3,3]请写出一个函数,找出该列表中没有重复的数的总和''' def func(l): res = [] sum_s = 0 for i in l: if i not in res: res.append(i) sum_s += i return sum_s list1 = [3, 4, 1, 2, 5, 6, 6, 5, 4, 3, 3] print(func(list1)) # 21
'''有一个列表[3,4,1,2,5,6,6,5,4,3,3]请写出一个函数,找出该列表中没有重复的数的总和''' def func(l): res = [] sum_s = 0 for i in l: if i not in res: res.append(i) sum_s += i return sum_s list1 = [3, 4, 1, 2, 5, 6, 6, 5, 4, 3, 3] print(func(list1)) # 21