Changes

Jump to: navigation, search

OPS435 Python Lab 4

11 bytes added, 07:53, 21 June 2017
PART 3 - Dictionaries
print(value)
</source>Additional Information regarding Dictionaries:<ul><li>The values and keys can be looped over using the index as well
::#The '''range()''' function provides a list of numbers in a range.</li><li>The '''len()''' function provides a the number of items in a list.</li><li>Used together '''len() and range()''' can be used to create a list of usable indexes for a specific list</li></ul><br><br>Let's construct create a table dictionary by using lists created in order to store our dictionary data. First, we need to pair the keys and values of two separate lists.<br><br>
::#Issue the following:<source>
list_of_keys = list(dict_york.keys())
list_of_keys[0]
list_of_values[0]
</source>Now, let's use these ''newly-created lists'', ''len()'' &amp; ''range()'' functions with a ''for loop'' to construct our tabledictionary:<br><br>
::#Issue the following:<source>
list_of_keys = list(dict_york.keys())
13,420
edits

Navigation menu