Caculate age

Peter Hansen peter at engcorp.com
Sat Feb 1 18:14:56 EST 2003


Ben wrote:
> 
> I am new at Python. I have an assignment to be written by tomorrow in Python.
> - Calculate a person's age based on a brithdate in any format

Since it isn't fair to anyone, especially to you, if we just
hand you the answer on a silver platter, perhaps you'd be
willing to share with us some of your attempts at solving
the problem, or your thoughts on how you might approach it.

Another thing you might do is to express your requirements in the 
form of tests.  If the solution passes those tests, then it meets
your requirements.  Maybe some examples of birthdates, in the
format you want to use, and the desired results.  This will make
it less likely your requirements will be misinterpreted, which 
is a good policy when doing software...

> Any help will be appreciated.

Maybe starting earlier next time would be a good strategy? ;-)

-Peter




More information about the Python-list mailing list