0
私は、テキストを反転させるためにリバース機能をしましたが、私はこのそれを印刷のであればG.変更「」文字列で「G」を「AGAG」
def reverse(text):
# Our empty string for the reversed text
reversed_text = ""
# Note: Indices are starting with zero and the last number in ranges aren't included
for i in range(len(text)):
reversed_text += text[len(text)-1-i]
return reversed_text
text = 'AGAGAGAGAGA'
print reverse(text)
にも変更する必要があります私AGAGAGAGAGAを与える代わりに、私は私がこれをどのように行うことができます
GAGAGAGAGA 必要があるでしょうか?文字列のスライス操作を使用して
あなたは[拡張スライス表記]を使用することができます(https://docs.python.org/2 /whatsnew/2.3.html#extended-slices)を使用してPythonの文字列を反転させます。 –