Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

103 bytes added, 22:52, 11 February 2018
Create a Python Script for Managing Dictionaries
:::*The script should contain '''three''' functions:
:::::'''create_dictionary()'''<ol><li>'''accepts''' two lists as arguments keys and values, '''combines''' these lists together to '''create''' a dictionary</li><li>'''returns a dictionary''' that has the keys and associated values from the lists<br>('''Tip:''' use a while loop to access elements in both the keys and values lists at the same time)</li></ol>
:::::'''shared_values()''' <ol><li>'''accepts''' two dictionaries as arguments and '''finds''' all values that are shared between the two dictionaries<br>('''Tip:''' generate sets containing only values for each dictionary, then use a function mentioned in a previous section to store the values that are common to <u>both</u> lists)</li><li>'''returns a set''' containing '''ONLY values''' found in '''BOTH dictionaries'''</li></ol>
:::*make sure the functions have the correct number of arguments required