题解 | #字符串加密#
字符串加密
http://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
password = input() # 获取目标密码
letter = "abcdefghijklmnopqrstuvwxyz"
str_c = ""
for i in str_a:
if i not in str_c: # 秘钥去重
str_c += i
for j in letter:
if j not in str_c: # 生成新字母表
str_c += j
stri01 = ""
for q in password:
a = -1
for w in letter:
a += 1
if q == w: # 获取旧字母表中秘钥字母对应的新字母表字母,形成加密密码
stri01 += str_c[a]
print(stri01)