On Apr 6, 2005 7:12 AM, John Carmona <[EMAIL PROTECTED]> wrote:
>
> Now I have got another question raising from this script. Would it be
> possible for the person doing the input to use either the months name in
> writing and also in number?

I can think of 2 ways to accomplish this.

1. Try to convert monthString to an int, use the lookup if that fails.
This might be a good way to learn try/except processing.

2. Just double-up your dictionary to include a second set of keys:

{'1':1, '2':2 ...}

and just use your existing lookup method, unmodified. You wouldn't
have to worry about string->int conversion after raw_input this way,
so it's cleaner to implement.

-- 
Kristian

kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to