MENU
Question -

When are dictionaries more useful than lists ?



Answer -

Dictionaries can be much more useful than lists. For example : suppose we wanted to store all our friendтАЩs cell phone numbers. We could create a list of pairs (phone number, name), but once this list becomes long enough searching this list for a specific phone number will get time consuming. Better would be if we could index the list by our friendтАЩs name. This is precisely what a dictionary does.

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×