more newbie help needed

john boy xray_alpha_charlie at yahoo.com
Mon Nov 14 14:20:46 EST 2005


using the following program:
 
fruit = "banana"
index = 0
while index < len (fruit):
     letter = fruit[index-1]
     print letter
     index= index -1
 
this program is supposed to spell "banana" backwards and in a vertical patern...it does this....but 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?

		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051114/bea19066/attachment.html>


More information about the Python-list mailing list