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 we are looking at. And index is a number, which means it's easier to reason about than letters are. Let's have a look at a possible solution: >>> vehicle = 'car' >>> index = 2 >>> print vehicle[index] r >>> index = 1 >>> print vehicle[index] a >>> index = 0 >>> print vehicle[index] c Notice that the three print statements are identical. That suggests we could write the code in a loop, with 'print vehicle[index]' in the body of the loop. Can you have a go at that? -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor