learning with python question (HtTLaPP)

Eric Wertman ewertman at gmail.com
Sat Apr 26 18:02:58 EDT 2008


>  Is the way I wrote the function inherently wrong?  What I wrote

I would not say that.  I think a lot of people probably start off like
that with python.  You'll find in most cases that manually keeping
counters isn't necessary.  If you really want to learn python though,
I would suggest using built in functions and libraries as much as
possible, as that's where the real power comes from (IMO).

>  returns the sequence, however I'm trying to make the output match for
>  the letters in the string entered, not necessarily the string
>  sequence.
>  Only the sequence shows up 'uzi'.  I don't get words like 'unzip' or
>  'Zurich' .  I've only barely started on invocation and maybe writing
>  something like I'm describing is above what level I'm currently at.

This would be a more difficult approach..   Where you are doing the
comparison step:

if letters in line.strip():

It's trying to match the exact string "uzi", not any of the individual
letters.  You would need to look for each letter independently and
then make sure they were in the right order to match the other words.



More information about the Python-list mailing list