Find the missing letter

charSet = set(chars)  #去重复
charSet = sorted(charSet) #排序

charSet = ''.join(charSet) #转换成字符串
flag = str.islower(charSet)
charSet = str.lower(charSet)
allChars = []
for i in range(97, 123):
allChars.append(chr(i))
firstWord = charSet[0]
lastWord = charSet[-1]

firstPosition = allChars.index(firstWord)
lastPosition = allChars.index(lastWord)
allChars = allChars[firstPosition:lastPosition + 1]
for i in range(0, len(allChars)):
if allChars[i] not in charSet:
if flag:

return allChars[i]
else:
return str.upper(allChars[i])
原文地址:https://www.cnblogs.com/sayHello2World/p/7130879.html