Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

50 bytes added, 16:49, 15 June 2017
PART 3 - Dictionaries
::#Let's begin by creating a new dictionary (for practice):<source>
dict_york = {'Address': '70 The Pond Rd', 'City': 'Toronto', 'Postal Code': 'M3J3M6'}
</source>::#The You should note that the syntax to define a dictionary is similar to use defining sets (i.e. using '''{}''' (like you learned with ).<br>Unlike sets), but place dictionaries use '''<code>key:value</code>''' pairs within the dictionary, each ''key:value'' pair in turn, are separated by commas.<br><br>
::#Issue the following and note all the available functions available to dictionary objects:<source>
dir(dict_york)
13,420
edits