判断字符串是否有重复字条
作者:互联网
strs = 'Goaod' hashTable = dict() listStrs = list(strs) i = 0 while i < len(strs): if listStrs[i] in hashTable: print("有重复字符") break else: hashTable[listStrs[i]] = None i += 1 if i >= len(strs): print("没用重复字符") break ee = 'aa111(((bbhhhhhh%jjjjjj%(ccc((vvvv22' cc='11222333' def max_letter_count(n): list4 = [] list1 = [] list2 = [] for i in n: list3 = [] count_max = n.count(i) list3.append(i) list3.append(count_max) list1.append(list3) list2.append(count_max) num=max(list2) for i in range(len(list2)): if list2[i] == num: list4.append(list1[i][0]) #return list(set(list4)),'字符出现最大次数为:%d' % num if num>=3: return True else: return False print(max_letter_count(ee))
标签:count,字条,重复,max,list3,list2,num,字符串,append 来源: https://www.cnblogs.com/xkdn/p/16403882.html