查找元组中不重复的数字及它的索引值
#coding:utf-8 tuple_a = (1,2,3,4,3,2,1)#找出不重复的数,并打印出来 for i in range(len(tuple_a)):#按长度遍历列表 if tuple_a.count(tuple_a[i])==1:#查找tuple中出现一次的数 print(tuple_a[i])#打印该数 print(i)#打印该数索引
#coding:utf-8 tuple_a = (1,2,3,4,3,2,1)#找出不重复的数,并打印出来 for i in range(len(tuple_a)):#按长度遍历列表 if tuple_a.count(tuple_a[i])==1:#查找tuple中出现一次的数 print(tuple_a[i])#打印该数 print(i)#打印该数索引