You can do this:

>>> word=raw_input("Type the word: ")
Type the word: Kokiri Forest
>>> print word
Kokiri Forest
>>> print word[::-1]
tseroF irikoK

But I saw that this gave you a hard time so this is an alternate longer way:

>>> backword=""
>>> counter=len(word)

>>> while counter!=0:
             backword+=word[counter-1]
             counter-=1

>>> print backword
tseroF irikoK

So choose the one you want and feel free to ask in case of any doubt

Regards

Alberto


 Gaucho
>From: "Jim and Laura Ahl" <[EMAIL PROTECTED]> >To: <tutor@python.org> >Subject: [Tutor] Python backwards program >Date: Tue, 12 Apr 2005 20:05:41 -0500 > >I am very new to programming and I have an assignment to have a raw_input string that is inputted by the user and then is printed backwards. Can anyone help me? I can get it to print regular but backwards in not working. > >Thank You >Jim >_______________________________________________ >Tutor maillist - Tutor@python.org >http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to