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])

posted on 2017-07-07 10:37  run_qin  阅读(375)  评论(0编辑  收藏  举报

导航