"john boy" <[EMAIL PROTECTED]> wrote:

> using the following program:
>
> fruit = "banana"
> index = 0
> while index < len (fruit):
>      letter = fruit[index-1]
>      print letter
>      index= index -1

> after spelling "banana" it gives an error message:
> refering to line 4: letter = fruit[index-1]
> states that it is an IndexError and the string index is out of range
> Anybody know how to fix this?

add "print index" before the "letter =" line to see what your program
is doing, and what index is when you get the error.  then read this:

http://docs.python.org/tut/node5.html#SECTION005120000000000000000

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to