dictionaries and strings such an implementation is obviously not very convenient if we have large number of input and output valueshowever an alternative implementation of the mapping would be to use two lists of equal lengthwherefor instanceitem in list countries corresponds to item in list capitals howeversince such general mappings are useful in many contextspython provides special data structure for themcalled dictionary data structures similar to dictionary are used in many programming languagesbut they often have different names common names are associative arraysymbol tablehash mapor simply map dictionary can be seen as generalization of listwhere the indices are not required to be integersbut can be any immutable python data type the "indicesof dictionary are called keysand through this course we will mostly use strings as dictionary keys the dictionary implementation of the mapping above looks like {'norway':'oslo','sweden':'stockholm','france':'paris'and we can look up values in the dictionary just as we would in listusing the dictionary key instead of an indexprint( ['norway']to extend the dictionary with new valueswe can simply write ['germany'berlin notice this important difference between list and dictionary for list we had to use append(to add new elements dictionary has no append methodand to extend it we simply introduce new key and corresponding value dictionaries can be initialized in two different waysone is by using the curly bracketsas in the example above alternativelywe can use the built-in function dictwhich takes number of key-value pairs as arguments and returns the corresponding dictionary the two approaches can look like mydict {'key 'value 'key 'value temps {'oslo' 'london' 'paris' or mydict dict(key =value key =value temps dict(oslo= london= paris= notice the differences in syntaxparticularly the different use of quotation marks when initializing using curly bracketswe use colon to separate the key from its corresponding valueand the key can be any immutable python object ( strings in the example abovewhen using the dict functionwe pass the key-value pairs as keyword arguments to the functionand the keywords are converted to keys of type string howeverin both cases