编程题

破译密码:经过研究,该密码的加密规律如下:

1)原文中所有的字符都在字母表中被循环左移了三个位置(dec -> abz);

2)逆序存储(abcd -> dcba );

3)大小写反转(abXY -> ABxy)。

输入:一个加密的字符串。(长度小于50且只包含大小写字母)

输出:输出解密后的字符串。

根据上述算法思想,补全下列代码。

输入输出示例:输入:djiAHYhSju,输出:XMvKbkdLMG

a=input()a=list(a)newList1=[]newList2=[]for i in a:    num=ord(i)    if num >=120 and num<=122:        num=           ①               elif num>=88 and num<=90:        num=num-23    else:        num =           ②               c=chr(num)    newList1.append(c)           ③           for i in newList1:    if i.isupper():        newList2.append(           ④           )    if i.islower():        newList2.append(i.upper())for i in newList2:    print(i,end='')

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论