酷代码 AI
菜单
服务商
DeepSeek字节豆包讯飞星火
更多选项

Python实现凯撒密码:小写字母后移n位加密字符串

```python def caesar_cipher(ming, n): cipher_text = '' for char in ming: if char.islower(): new_char = chr((ord(char) - ord('a') + n) % 26 + ord('a')) else: new_char = char cipher_text += new_char return cipher_text ming = input() n = int(input()) result = caesar_cipher(ming, n) print(result) ``` ######[AI写代码神器 | 243点数解答 | 2024-12-16 16:21:46]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]