Newby - is this what they are looking for ?? and is their a better a way
digitig at gmail.com
Tue Feb 24 10:11:46 EST 2009
You're doing well so far. As Chris has said, you need to read the
later part of the question more carefully. A couple of other things:
1. 'input' might not be the best way to get the phrase, because the
user will have to put the phrase in quotes or the program will
(probably) crash. Have a look at raw_input.
2. A cosmetic thing. Your users will be happier if you put a space
after 'enter a phrase'
3. A "better way" might not be a better way for you. There's a very
Pythonic way of doing this using something called list comprehensions,
but they're almost certainly not what your tutor wants because they're
rather more advanced than the level you're working at. If it wasn't
for the requirement to put the acronym into the variable "letters",
the whole task could be done in one Python statement. Don't try that.
Keep it simple, the way you have been so far.
4. If you want to be a wise guy, ask your tutor why he/she got you to
convert the whole phrase to upper case, wasting a whole pile of
character conversion operations under the hood, because it's only the
acronym that needs to be converted :-)
More information about the Python-list