[Tutor] printing answers

Rich Krauter rmkrauter at yahoo.com
Fri Feb 6 13:20:13 EST 2004


Hi Christopher,

> Hmmm...Now that I look at the program, I see you are
> right!  Thanks for the reply!  The question now is how
> do I fix it?  Any hints?
> 
> -Chris

Did you see Karl's reply? I thought that was a really good suggestion.

If Karl's reply is not what you want, you need to be a little more
explicit about your requirements, and the type of output you expect.
It's easiest if you express what output you want in python, not in
words:

i.e. you can say something like 
"""
My input is [...]. My function is [code]. I want to use regular
expressions, and I want the output to be a list of tuples that looks
like this:
[('oNe','One'),('TWo'),('thREE','three')].
"""

You said your function is outputting the wrong thing, but you forgot to
say explicitly, in python, what the right thing is. And you didn't
explicitly say you need to use regexes. 

I'm not meaning to sound critical. I'm new to this too, and I often have
the same problem - until I remember that python can express what I mean
better than my verbal explanation what I want python to do. 

Rich







More information about the Tutor mailing list