Caculate age

Ben Patel benvpatel at
Sun Feb 2 22:57:52 CET 2003

Thanks for your quick response. 
I am trying to write a function which will take a String as an argument and add it to a hashtable. If the value entered is in the Hashtable then print it or else error out. 
Here is what I have written so far : 
import sys 
def mydict(y):
#y = raw_input ("Please enter a String: ")
    if len(y) > 1:
        x[i] = i
        x[i] = y
        i = i+1
        #return x.values()
#print x.has_key(1)
#print y, z
print x.keys()
print x.values()

Any advice ! 

 Laura Creighton <lac at> wrote:> Hi:
> 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
> Any help will be appreciated.
> Thanks in advance
> Ben
> -- 

I assume that you have a program that works to calculate a person's
age based on _some_ format. If you cannot do that, then you need to
learn Python, period, and while learning Python is fast, I don't
know if it is that fast.
is probably your best bet at trying to learn Python overnight, unless
you are already an experienced programmer where 'Dive into Python'
at might suit you better. One day is
still probably asking a lot.

But assuming that you have a program that works for some valid date,
the hard thing about this assignment is the 'any format' part. This
sort of thing is best done with unit tests, and as part of the reference you get 
'' which explains how you
do this, with examples for converting numbers from 1-3999 into their
Roman Numeral equivalents. While this is the right way to do things,
it is quite possible that it has nothing to do with how your teacher
desires you to solve your assignment, which means you could be
100% correct and still get a rotten mark, which would stink.

Good luck,
Laura Creighton

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list