Dictionary question.

hawkesed olaamigoquepasa at hotmail.com
Thu Apr 21 05:47:42 EDT 2005


Hi,
  I am semi new to Python. Here is my problem : I have a list of 100
random integers. I want to be able to construct a histogram out of the
data. So I want to know how many 70's, 71's, etc. I can't figure out
how to do this. A dictionary is supposedly can do key value pairs
right? I want to be able to see if say 75 is in the data structure, and
what its value is, then increment its value as I go through the list
finding items.
  I am sure there is a way to do this. Is a dictionary what I should be
using? Thanks for any help. Hope this makes sense, its getting very
late here.
Regards all.
Ed




More information about the Python-list mailing list