Question: CS 1 1 5 - Introduction to Programming in Python Lab 0 4 Lab Objectives: Files, Modules, Functions Write a module, Lab 0 4 _
CS Introduction to Programming in Python
Lab
Lab Objectives: Files, Modules, Functions
Write a module, LabModule.py that contains the following functions:
cleandata takes a string as a parameter and does the following:
Replace all newline characters with a single space.
Replace punctuation with an empty string.
Converts the string to lowercase.
Returns the updated version of the string.
findunique takes a string as a parameter, and returns a string containing each unique word in the string separated by spaces and the count of unique words in the string.
countunique takes a string file name as a parameter. Each line in the file contains a set of unique words, and the count of the unique words as the last value on each line. The functions should sum the values at the end of each line. You may assume that the value is preceded by a comma.
Write a program that uses the functions in the module defined above and does the following:
a Using a loop reads the data from input files wordstxt wordstxt wordstxt
b Cleans the data in each file.
c Finds the unique words and their count for each file, and writes to an output file.
d Using the output file from step c displays the sum of all unique words from the files.
Sample Input Files:
Sample Run:
Number of unique words in files: Dont use lists
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
