Q. 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 friends' cell-phone numbers. We could create a list of pairs (name of friend, phone number), 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.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post