Changes

Jump to: navigation, search

OPS435 Python Lab 4

93 bytes added, 17:17, 15 June 2017
PART 3 - Dictionaries
dict_york.values()
dict_york.keys()
</source>'''WARNING: Dictionary keys must be unique'''. Attempting to add a key that already exists in the dictionary will <u>overwrite </u> the existing value for that key.!<br><br>
::#To demonstrate, issue the following:<source>
dict_york['Province'] = 'ON'
dict_york.values()
dict_york.keys()
</source>You should notice that key value for 'Province' has been changed back to 'ON'.<br><br>
::#These lists that contain the values and keys of the dictionary are not <u>real</u> python lists; instead, they are views of the dictionary<br><br>On the other hand, you can change these views into usable lists by using the '''list()''' function (where the index can be used to access individual values).<br><br>
::#For example, issue the following:<source>
13,420
edits

Navigation menu