题解 | 凯撒加密

凯撒加密

https://www.nowcoder.com/practice/006b7917d3784371a43cfbae01a9313d

n = int(input())
s = str(input())

mima = []

for i in range(len(s)):
    mima.append(chr((ord(s[i]) - ord('a') + n) % 26 + ord('a')))  #超过z

print(''.join(mima))  #转为字符串输出


全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务