Hello:

I am trying to write a code (this is an exercose from
a book). The goal is to write a program that takes a
string  and outputs the letters backward, ine per
line.
Ok. I did a test first, by writing a code with
numbers:

a=0; b=10
while a<=b:
   print b
   b -= 1

Here the output is:
10
9
8
7
6
5
4
3
2
1
0
That worked fine.
Now, back to my exercise. I tried to write a code that
takes the string 'car' as the input:

vehicle='car'
index = vehicle[-1]       #the last letter
index_zero = vehicle[0]   #the first letter

while index >= index_zero:
   letter=vehicle[index]
   print letter
   index -= 1

The problem is that I get no output here. Could I hear
from you?

Thanks!
Hoffmann


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to