subject
Engineering, 10.11.2019 03:31 Hellopeople233

Pyhtonwrite a function named repeatwords() that takes two string parameters: 1. the name of an input file that exists before repeatwords() is called2. the name of an output file that repeatwords() createsassume 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 repeatwords() should write to the output file all of the words that appear more than once on that line. each word should be lower cased and stripped of leading and trailing punctuation. each repeated word on a line should be written to the corresponding line of the output file only once, regardless of the number of times the word is repeated. for example, if the following is the content of the file catinthehat. txt: too wet to go out and too cold to play ball. so we sat in the house. we did nothing at all. so all we could do was to sit! sit! sit! sit! the following function call: inf = 'catinthehat. txt'outf = 'catrepwords. txt'repeatwords(inf, outf)should create the file ‘catrepwords. txt’ with the content: too tosithint: for each line, create a list of repeated words and then write the list (without repetition) to the outfile. be sure to test your solution with input in which some repeated words on a line are a mixture of upper and lower case, and in which repeated words sometimes are preceded or followed by punctuation

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Draw the engineering stress-strain curve for (a) bcc; (b) fcc metals and mark important points.
Answers: 1
question
Engineering, 04.07.2019 18:10
Atmospheric air has a temperature (dry bulb) of 80° f and a wet bulb temperature of 60° f when the barometric pressure is 14.696 psia. determine the specific humidity, grains/lb dry air. a. 11.4 c. 55.8 d. 22.5 b. 44.1
Answers: 1
question
Engineering, 04.07.2019 19:10
Apressure vessel with an r/t 20 cannot be treated as thin walled vessel. a)-trune b)- false
Answers: 3
question
Engineering, 06.07.2019 05:10
Air at 27°c and at atmospheric pressure flows over a fat plate at a speed of 2 m/sec. if the plate is maintained at 93°c, calculate the heat transfer for unit wid h of the plate; assuming the length of the plate along the flow of air is 2 metres.
Answers: 3
You know the right answer?
Pyhtonwrite a function named repeatwords() that takes two string parameters: 1. the name of an input...
Questions
question
Mathematics, 08.12.2019 07:31
Questions on the website: 13722363