def applyCoder(text, coder):
"""
Applies the coder to the text. Returns the encoded text.
text: string
coder: dict with mappings of characters to shifted characters
returns: text after mapping coder chars to original text
"""
### TODO.
new = ""
for word in text:
if word in string.ascii_lowercase or word in string.ascii_uppercase:
new = new + coder[word]
else:
new = new + word
return new
少了红色部分一直返回 keyerror /(ㄒoㄒ)/~~