## Create a new project in pycharm ? Add wordhistogram.py (available on the Week 10 course content page) into the project.

Create a new project in pycharm ? Add wordhistogram.py (available on the Week 10 course content page) into the project. ? Now we need to make the wordhistogram.py more testable. This can be done by converting the codes into two python files with functions: o One file is named wordcount.py, which contains: ? One function (f1) for reading a file and creating a dictionary ? One function (f2) for sorting a dictionary reversely based on count of each word o One file is named histogram.py, which contains: ? One function (f3) for converting a dictionary into a histogram. ? Write a main function and call the methods from the main function. This can be in a separate file or as part of histogram.py Task 2 – Unit Test Example 1: Word Histogram (UG: 3 marks, Master’s: 2 marks) ? Learn how to use the unit test module in Python. ? Write a program word_test.py to test the above methods with various test cases: o For f1, try empty filename and wrong file name o For f2, try input types other than dictionary, empty dictionary o How do you test f3? Write your test code. o Fix the bugs in your word histogram code Submit your wordcount.py, histogram.py, and word_test.py code. Task 3 – Unit Test Example 2: Recursion (Master’s: 1 mark) ? Two versions to calculate factorial (iterative and recursion) def iterative_factorial(n): result = 1 for i in range(2,n+1): result *= i return result def factorial(n): if n == 1: return 1 else: return n * factorial(n-1) ? Create test cases for the recursion version, and store them in factorial_test.py ? Fix the functions so they deal with invalid input

### which statement will read the file into memory?

A.Opening a file in read mode performs which operation?   a. Creates a new file                        b. Reads consecutive characters from a file c. Reads all the content of a file   ….

### The PR intervals with 2nd degree AV heart block, type I

A. The PR intervals with 2nd degree AV heart block, type I   a. are constant. b. are absent. c. are shorter in duration than 0.12 seconds. d. become progressively….

### Write a program that compares two fi les whose names are provided as user input.

Assuming that a text fi le contains characters in the ASCII range 0 to 127 and contains at least one newline character, create a function that uses the fi lename….