Thanks Kristian, it is working fine now. I am learning so much with those
little exercises, I know they are probably very basics to most of the people
of this forum but they are great for a beginner like me. Jacob has sent me a
few exercise to do, some look pretty difficult for my level so surel
On Apr 6, 2005 11:58 AM, John Carmona <[EMAIL PROTECTED]> wrote:
> When you say to double-up the dictionary do you mean using the following
> method:
>
> Dict = [{1:1,2:4,etc.},
> {3:9,4:16, etc}]
You're close, but a list of dicts is overkill here; stick to one big
dict, and leave the keys as str
Kristian you have said:
-
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.
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 co
Thanks John for your help.
Here is the final script (and it is working)
--
import calendar
MonthName = {'January': 1,'February': 2, 'March': 3,'April': 4
,'May': 5,'June': 6,'July': 7,'August': 8,
Quoting John Carmona <[EMAIL PROTECTED]>:
Hi John,
Some comments ---
> import calendar
>
> MonthName = {'January': 1,'February': 2, 'March': 3,'April': 4\
> ,'May': 5,'June': 6,'July': 7,'August': 8,\
> 'September': 9,'October': 10,'November': 11,'December': 12}
You can actually get away wit
Roel you wrote:
-
A dictionary is a data structure containing keys and values that defines
a mapping from each key to its corresponding value. You define it like this:
>>> squares = {1: 1, 10: 100, 4: 15,
John Carmona wrote:
> Kristian you wrote:
>
> -
>
> This assumes all input as integers; if you want months entered by
> name, you'll have to write a conversion routine (hint: use a dict).
> --