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 if ステートメントが真であると評価されたかどうかを確認するために print("hi") ステートメントを配置しましたが、決してそうではありません。 . 誰かが理由を教えてもらえますか?