dict similar effect occurs with the use of the update(method for these reasonspassing keyword arguments or an unordered dict when creating an ordered dictionary or using update(on one is best avoided howeverif we pass list or tuple of key-value -tuples when creating an ordered dictionarythe ordering is preserved (since they are passed as single item-- list or tuplehere' how to create an ordered dictionary using list of -tuplesd collections ordereddict([(' '- )(' ' )(' ' )]because we used single list as argument the key ordering is preserved it is probably more common to create ordered dictionaries incrementallylike thistasks collections ordereddict(tasks[ "backuptasks[ "scan emailtasks[ "build systemif we had created unordered dicts the same way and asked for their keysthe order of the returned keys would be arbitrary but for ordered dictionarieswe can rely on the keys to be returned in the same order they were inserted so for these examplesif we wrote list( keys())we are guaranteed to get the list [' '' '' ']and if we wrote list(tasks keys())we are guaranteed to get the list [ one other nice feature of ordered dictionaries is that if we change an item' value--that isif we insert an item with the same key as an existing key--the order is not changed so if we did tasks[ "daily backup"and then asked for the list of keyswe would get exactly the same list in exactly the same order as before if we want to move an item to the endwe must delete it and then reinsert it we can also call popitem(to remove and return the last key-value item in the ordered dictionaryor we can call popitem(last=false)in which case the first item will be removed and returned anotherslightly more specialized use for ordered dictionaries is to produce sorted dictionaries given dictionarydwe can convert it into sorted dictionary like thisd collections ordereddict(sorted( items())note that if we were to insert any additional keys they would be inserted at the endso after any insertionto preserve the sorted orderwe would have to re-create the dictionary by executing the same code we used to create it in the first place doing insertions and re-creating isn' quite as inefficient as it soundssince python' sorting algorithm is highly optimizedespecially for partially sorted databut it is still potentially expensive in generalusing an ordered dictionary to produce sorted dictionary makes sense only if we expect to iterate over the dictionary multiple timesand if we do not expect to do any insertions (or very few)once the sorted dictionary has