康康哪里有错,求解答呀

s = input()
key = []
for i in s:
if i not in key:
keyappend(i)
key.reverse()
i=0
while len(key)<26:
t = chr(ord('z')-i)
if t not in key:
key.append(t)
i+=1
d = {}
for i in range(26):
d[chr(ord('a')+i)] = key[i]

old = input()
new = ''
for i in old:
if i not in d:
new += i
else:
new += d[i]
print(new)

第5行少了个.
倒数第四行的往里 缩进一下

s = input()
key = []
for i in s:
    if i not in key:
        key.append(i)
key.reverse()
i=0
while len(key)<26:
    t = chr(ord('z')-i)
    if t not in key:
        key.append(t)
    i+=1
d = {}
for i in range(26):
    d[chr(ord('a')+i)] = key[i]

old = input()
new = ''
for i in old:
    if i not in d:
        new += i
    else:
        new += d[i]
print(new)