r_number = [1, 2, 3, 2, 3, 6, 1,]
c = []
for i in range(len(r_number)):
for k in range(len(r_number)):
if r_number[i] == r_number[k]:
break
else:
print(r_number[i])
r_number = [1, 2, 3, 2, 3, 6, 1,]
for i in range(len(r_number)):
if r_number[i] not in r_number[0:i] and r_number[i] not in r_number[i+1 : ]:
print(r_number[i])
利用HASH进行判断, L神设计
nums = [1,2,3,4,5,6,7,8,9,1,2,3,5,6,7,8,9]
dic = {}
for i in nums:
dic[i] = dic.get(i,0) + 1
for i in dic:
if dic[i] == 1: