Hi, 

This is how I would do it, although there might be more readable solutions:
s = raw_input("Enter a message: ")
print "".join([s[-letter] for letter in range(len(s)+1)])

Cheers!!
Albert-Jan

--- On Tue, 6/16/09, Alan Gauld <[email protected]> wrote:

> From: Alan Gauld <[email protected]>
> Subject: Re: [Tutor] Help Needed
> To: [email protected]
> Date: Tuesday, June 16, 2009, 1:57 AM
> 
> "Raj Medhekar" <[email protected]>
> wrote
> 
> > I am looking to build a program that gets a message
> from the user and then prints it backward. I 've been at it
> for hours now but I can't seem to figure it out. 
> 
> So tell us what you re thinking? How would you solve it
> manually?
> 
> > I've been having trouble trying to index the message
> so I can print it out backwards. 
> 
> You can index the characters of a string in Python exactly
> as you do a list.
> 
> > I would've posted my code but I really haven't gotten
> past the  'raw_input("Enter a message: ")' command
> line.  
> 
> Its always better to try something even if its wrong, it
> lets us see where your thinking is going adrift. Or at least
> describe what you'd like to do conceptually.
> 
> Alan G.
> 
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor
> 


      
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to