<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

> test = 3   #find person with this number
> for x in xrange(len(phone.keys())):
>   print x
>    if phone[phone.keys()[x]] == test:
>       print phone.keys()[x]
>       break
>
>Being a newbie myself, I'd love a little critique on the above.  Be kind

Constructs like xrange(len(something)) are fairly typical for somone
moving to Python from another language; usually there is a more
idiomatic alternative.

In this case, writing "for k in phone.keys()" would be a good start.







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

Reply via email to