look essentially random if you want to keep collection of items in certain orderyou need sequencenot mapping to summarizedictionaries are mutable collections that implement mapping from keys to values our password example showed dictionary having strings as both keys and values in generalkeys can be any immutable typeand values can be any type at allincluding programmerdefined classes python dictionaries are very efficient and can routinely store even hundreds of thousands of items dictionary operations like listspython dictionaries support number of handy built-in operations you have already seen how dictionaries can be defined by explicitly listing the key-value pairs in curly braces you can also extend dictionary by adding new entries suppose new user is added to our password system we can expand the dictionary by assigning password for the new username passwd['newuser''imanewbiepasswd {'turing''genius''bill''bluescreen''newuser''imanewbie''guido''superprogrammer'in facta common method for building dictionaries is to start with an empty collection and add the key-value pairs one at time suppose that usernames and passwords were stored in file called passwordswhere each line of the file contains username and password with space between we could easily create the passwd dictionary from the file passwd {for line in open('passwords',' ')userpass line split(passwd[userpass to manipulate the contents of dictionarypython provides the following methodsmethod in keys(values(items(get(del [clear(for in meaning returns true if dictionary contains the specified keyfalse if it doesn' returns sequence keys returns sequence of values returns sequence of tuples (key,valuerepresenting the key-value pairs if dictionary has key returns its valueotherwise returns default deletes the specified entry deletes all entries loop over the keys