alphabet =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
def decoder(input):
inputlist = list(input)
inputlength = len(input)
alphabetlength = len(alphabet)
result = "Decoded Sentence: "
for x in range(inputlength):
for y in range(alphabetlength):
if inputlist[x] is alphabet[y]:
print ("hi")
if y == 24:
result += "a"
if y == 25:
result += "b"
else:
result += alphabet[y+2]
if inputlist[x] is "(":
result += "("
if inputlist[x] is ")":
result += ")"
if inputlist[x] is ".":
result += "."
if inputlist[x] is " ":
result += " "
return result
我的代码应该将句子的字母增加 2。例如:a->c, l->n 我使用 print("hi") 语句来检查 if 语句是否被评估为真,但它从来没有. 有人可以告诉我为什么吗?