题解 | #字符串加密#
字符串加密
http://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
while 1: try: s1 ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' ins = input() key1 = ''# key1空串 用来放置输入的key for i in ins.upper():# key1去重 if i not in key1: key1+=i for i in s1: # key1补全所有大写字母 if i not in key1: key1+=i key1 +=key1.lower()# key1补全小写字母 zm = s1+s1.lower()# 字母表 dic = dict(zip(list(zm),list(key1))) s = ''# s 空串 放置要输出的文字 mm = input() for i in mm: s+=dic[i] print(s) except: break