bruno modulix wrote:
> G. Völkl wrote:
> > Hello,
> >
> > I use a dictionary:
> >
> > phone = {'mike':10,'sue':8,'john':3}
> >
> > phone['mike']   --> 10
> >
> > I want to know who has number 3?
> > 3 -->  'john'
>
> Note that you can have many keys with the same value:
> phone = {'mike':10,'sue':8,'john':3, 'jack': 3, 'helen' : 10}

Of course in the real world using given name as a unique key is
ludicrous: 'mike' is a.k.a. 'michael' (or 'mikhail' or 'michele' (which
may be a typo for 'michelle')), and if there's only one 'sue' in your
little black book you need to get out more :-)

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to