def shift_char(word):
a = 'abcdefghijklmnopqrstuvwxyz'
b = []
c = []
for i in a:
b.append(i)
for j in word:
for k in b:
if j == k:
# 获取指定元素的索引
m = b.index(j)
c.append(b[m + 1])
# 将列表转化为字符串
return ''.join(c)
# 获取单词
word = input()
# 调用函数
print(shift_char(word))
编写一个程序,将给定单词的每个字母替换为字母表中的下一个字符。
最新推荐文章于 2024-08-12 18:10:44 发布