CSC108H Exercise 3

Due Date: 2012-07-17 23:55

In a file called e3.py, write the following functions.

Function name:
(Parameter types) -> Return type
Description
symmetric_difference:
(dict, dict) -> dict
Return a new dict that contains all of the {key:value} pairs whose key is a key in one of the input dictionaries, but not in both.
sort_by_value:
(dict of {immutable_type:int}) -> list
Return a list of keys in the dictionary sorted in ascending order according to their values. Keys with identical values might be sorted in any order.
load_words:
(file) -> dict of {str : list of strs}
The open file contains one lowercase word per line. Return a dictionary in which each key is a single lowercase letter and each value is a list of the words from the file that start with that letter. Only letters that one or more words from the file start with appear as keys in the dictionary.

Content of e3.py: Your e3.py file should contain the function definitions specified above. The file may also include test code, but any test code should be entirely within the main block and not anywhere else in e3.py.

Pre-marking: We will "pre-mark" the exercise by getting your most recent submission from the online submission system (MarkUs), running our tests on it, and giving you the results (in a file called test_e3.out on MarkUs). This will be done at least 4 times a day. You may resubmit as often as you like; the version in MarkUs at the deadline is what your exercise mark is based on.

What To Hand in: Submit e3.py, according to the instructions on the course website. Remember that spelling of filenames and function names, including case, counts: your files and functions must be named exactly as specified above. Remember also that your submission will be marked on CDF, so you should make sure it works on CDF.