[Tutor] newbie 'while' question

Matthew Richardson marichar@csusb.edu
Mon Jun 30 13:50:05 2003


I'm working through Josh Cogliati's tutorial and Wesley Chun's book to
learn Python.  So far things have been going smoothly, easy to say since
I've only hit the third chapter.  However, I'm stuck on an easy problem
and it's causing me grief because I know it should be easy.  The
exercise is to take a string that is inputted by the user and print each
letter of the string individually, solve with a 'for' and a 'while.'

The 'for' was easy:

s = raw_input('Enter a name: ')
for x in s:
    print x

Trying to do it with 'while', I've only managed to get it to print
through to the last character, where it loops and continues to print the
last character until escaped.  Someone willing to point me in the right
direction?

Thanks,
Matt

-- 
Matt Richardson
Instructional Support Technician
Department of Art
CSU San Bernardino