Write and test Python functions for each of the following. When writing a function, include a docstring.

Implement the function pairSum that takes as parameters a list of distinct integers and a target value n and prints the indices of all pairs of values in the list that sum up to n. If there are no pairs that sum up to n, the function should not print anything. Note that the function does not duplicate pairs of indices.
Implement the function unique that takes as a parameter a two-dimensional list and returns a one-dimensional list containing all the unique entries in the list. The entries in the list returned do not need to be ordered in any particular way. For example, in the list [[1, 0, 1], [0, 1, 0]] there are only two unique values (0 and 1) so the function would return the list [0, 1] (or the list [1, 0] — both are valid). The list passed as a parameter should not be altered by the function.
Study the count_word function in the table.py file and use it in another function (called display_counts) to print your selection of word counts from a text file (e.g. pride.txt or tale.txt). The function display_counts should take one parameter, a string that represents the name of the file. You may choose what word counts to display (e.g. words longer than 10 characters, or a specific list of words). Does your display show meaningful differences between the Jane Austin novel and the Charles Dickens novel?

Sample Solution

This question has been answered.

Get Answer