<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<FONT face="Franklin Gothic Medium">Im trying to code a program where the user enters a message and it is returned backwards. Here is my code so far:</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">
<HR id=null>
</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">message = input("Enter your message: ")</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">backw = ""</FONT><BR>
<FONT face="Franklin Gothic Medium">counter = len(message)</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">while message != 0:</FONT><BR>
<FONT face="Franklin Gothic Medium">&nbsp;&nbsp;&nbsp; backw += message[counter-1]</FONT><BR>
<FONT face="Franklin Gothic Medium">&nbsp;&nbsp;&nbsp; counter -= 1</FONT><BR>
<BR id=ecxFontBreak><FONT face="Franklin Gothic Medium">print(backw)</FONT><BR>
<FONT face="Franklin Gothic Medium">input("\nPress enter to exit...")</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">
<HR id=null>
</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">I run the program, type in my message but get back the error code:</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">'IndexError: String out of range'</FONT><BR>
<FONT face="Franklin Gothic Medium"></FONT>&nbsp;<BR>
<FONT face="Franklin Gothic Medium">I was thinking that maybe the problem is that each time a letter is taken from 'message' and added to 'backw', the length of message becomes a letter shorter but for whatever reason the variable 'counter' doesnt change when its supposed to be minused by 1 letter so its always bigger than message if that makes sense. Any help is much appreciated and thanks in advance.<BR><BR>Myles Broomes<BR></FONT><BR>                                               </div></body>
</html>