Question: need a simple python code. thanks! Due (section dependent) Submit your solutions to Problems 1-3 below as a py file via Moode Read Chapter 14

 need a simple python code. thanks! Due (section dependent) Submit your

solutions to Problems 1-3 below as a py file via Moode Read

need a simple python code. thanks!

Due (section dependent) Submit your solutions to Problems 1-3 below as a py file via Moode Read Chapter 14 in the textbook. You can also read about files in the Python tultorial Problem 1. Write a function five_ copy) that takes two string parameters (in file and out file) and copies the content of in file into out file. Assume that in file exists before file_copy is called. For example, the following would be correct input and output >>> file copyt 'created equal.txt, copy.txt) >>> open-f open(.copy.txt.) equal f open('created equal.bxt) >>> equal f.read() We hold these truths to be self-evident, inthat all men are created equ alin Problem 2. Write a function named file stats that takes one string parameter (in file) that is the name of an existing text file. The function fle stats should cakculate three statistics about in file: the number of lines it contains, the number of words and the number of characters and print the three statistics on separate lines. For example, the following would be be correct input and output. (Hint: the number of characters may vary depending on what platform you are working ) >>> file stats('created equal.txt') lines 2 words 13 characters 72 roblem 3. Write a function named repeat words that takes two string parameters 1. the name of an input file that exists before repeat_ words is called 2, the name of an output file that repeat words creates Assume that the input file is in the current working directory and write the output file to that directory For each line of the input file, the function repeat words should write to the output fie all of the words that appear more than once on that line. Each word should be lower cased and stripped of leading and tralling punctuation. Each repeated word on a line should be written to the corresponding line of the output fie only once, regardless of the number of times the word is repeated. For example, if the following is the content of the fie catin TheHat.bxt Too wet to go out and too cold to play ball So we sat in the house. RP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!