Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

97 bytes removed, 08:32, 21 June 2017
PYTHON REFERENCE
| style="border: 2px solid black;" | Strings
| style="border: 2px solid black;" | Regular Expressions
| style="border: 2px solid black;" | Strings
| style="border: 2px solid black;" | Miscellaneous
:*[https://docs.python.org/3/library/re.html Regular Expression Operations]
:*[https://docs.python.org/3/howto/regex.html Regular Expressions (HOWTO)]
| style="border: 2px solid black;" valign="top"|
| style="border: 2px solid black;" valign="top"|
:*[https://docs.python.org/3/tutorial/datastructures.html#dictionaries Dictionaries]
:::::'''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</li></ol>
:::::'''split_dictionary()'''<ol><li>'''accepts''' a single dictionary as a argument and '''splits''' the dictionary into two lists, keys and values</li><li>'''returns two lists''': The return function can return multiple lists (separated by a comma). In our case, use: '''return keys, values'''</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 lists 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
:::*The script should show the exact output as the samples
13,420
edits