Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Kent Johnson
Hoffmann wrote: > We are almost there. I changed the code and, at least, > I got the correct output. However, I also got a > traceback. I didn't understand the traceback. Could > you clarify that? > Thanks, > Hoffmann > ps: The new code: > > vehicle='car' index = -1 #index of the last le

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
> Hi John, > > We are almost there. I changed the code and, at least, > I got the correct output. However, I also got a > traceback. I didn't understand the traceback. Could > you clarify that? > Thanks, > Hoffmann > ps: The new code: > > >>> vehicle='car' > >>> index = -1 #index of the last lette

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Hoffmann
--- Adam <[EMAIL PROTECTED]> wrote: > I just wanted to throw in a couple of ideas for you > on this subject. > These are the ways I would personally think of going > about this > problem: > > >>> ''.join([s[n] for n in range(len(s)-1, -1, -1)]) > 'rac' > Which looks a bit fugly but is nice and sh

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
I just wanted to throw in a couple of ideas for you on this subject. These are the ways I would personally think of going about this problem: >>> ''.join([s[n] for n in range(len(s)-1, -1, -1)]) 'rac' Which looks a bit fugly but is nice and short if you can manage list comps. and now my favourite

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Hoffmann
--- John Fouhy <[EMAIL PROTECTED]> wrote: > On 29/03/06, Hoffmann <[EMAIL PROTECTED]> wrote: > > Hi John, > > > > (1) vehicle[index] is: 'c' > > (2) If index = index = 1, so vehicle[index] > becomes: > > 'a' > > What I'm getting at here is that, by changing index, > we can change > which letter w