for the slicing see: http://docs.python.org/lib/typesseq.html
for a longhand loop approach see: http://docs.python.org/tut/node6.html#SECTION006200000000000000000
On Apr 13, 2005, at 12:46 AM, Danny Yoo wrote:
---------- Forwarded message ---------- Date: Tue, 12 Apr 2005 22:37:44 -0500 From: Jim and Laura Ahl <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python backwards program
I have read about loops, strings, tuples. I am taking this class on distance education and I am lost with this assignment. I have read what Tony has wrote and that does me no good. I do not understand what he is talking about. I understand how slicing works and what the numbers mean. I know what the -1 and such like that mean. I know what the len function does. I am wasting you guys time.
Thanks Jim ----- Original Message ----- From: Danny Yoo To: Tony Meyer Cc: 'Jim and Laura Ahl' ; tutor@python.org Sent: Tuesday, April 12, 2005 9:09 PM Subject: RE: [Tutor] Python backwards program
On Wed, 13 Apr 2005, Tony Meyer wrote:
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.
I guess that I shouldn't give code if this is for an assignment, but if
you are using Python 2.4, then try seeing what the "reversed()" built-in
function does. If you're not using Python 2.4, then read up about
"slices" - which is when you get subsections of a string (e.g.
"tony"[2:4] is "ny"). You can pass a 'direction' in a slice as well.
It might also help to have a better feeling for what Jim already knows.
If this is a school assignment, I doubt that reversed() is allowed, nor
reverse slices, since that would make the problem too easy. *cough*
Jim, can you give a brief description of what things you've learned already? Do you already know about loops?
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor