Dictionary question.

hawkesed olaamigoquepasa at hotmail.com
Thu Apr 21 20:13:48 EDT 2005


Steve,
 thanks for the input. That is actually what I am trying to do, but I
don't know the syntax for this in python. For example here is a list I
want to work with as input:
[101, 66, 75, 107, 108, 101, 106, 98, 111, 88, 119, 93, 115, 95, 114,
95, 118, 109, 85, 75, 88, 97, 53, 78, 98, 91, 115, 77, 107, 153, 108]
Here is as far as I have gotten coding:
>>> for num in alist:
... 	if adict.has_key(num):
... 		x = adict.get(num)
... 		x = x + 1
                # dont know how to update a value here
         else:
               // add key with value one here somehow.
Thats where I am at now.
For the record, I am not taking a class on python and using this forum
to do my homework. I graduated in 1999 and am trying to get familiar
with python and refresh my statistics skills. Python seems like it
would be a good language to do math/stat work in, in a lightweight way.

Thank for all the help and have a great day!
Ed




More information about the Python-list mailing list