572
edits
Changes
m
→PART 3 - Dictionaries
::'''Perform the Following Steps:'''
::#Let's begin by creating a new dictionary in a temporary Python file:<source lang="python">
dict_york = {'Address': '70 The Pond Rd', 'City': 'Toronto', 'Postal Code': 'M3J3M6', 'Province': 'ON'}
</source>You should note that the syntax to define a dictionary is similar to defining sets (i.e. using '''{}'''), but unlike sets dictionaries use '''<code>key:value</code>''' pairs within the dictionary, each ''key:value'' pair is separated by commas.
::#All the values in a dictionary can be retrieved by using the '''dictionary.values()''' function. This particular function provides a '''list''' containing all values:<source lang="python">