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, 03.07.2019 14:10
Explain the difference laminar and turbulent flow. explain it with the shear stress and the velocity profiles.
Answers: 1
question
Engineering, 04.07.2019 18:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
question
Engineering, 04.07.2019 18:20
A3-mm-thick panel of aluminum alloy (k 177 w/m-k, c 875 j/kg-k and ? = 2770 kg/m) is finished on both sides with an epoxy coating that must be cured at or above t,-150°c for at least 5 min. the production line for the curing operation involves two steps: (1) heating in a large oven with air at ts,0-175°c and a convection coefficient of h, 40 w/m2. k, and (2) cooling in a large chamber with air at 25°c and a con- vection coefficient of he 10 w/m2.k. the heating portion of the process is conducted over a time interval te which exceeds the ime required to reach 150°c by 5 min (h = r + 300 s). the coating has an emissivity of ? = 0.8, and the temperatures of the oven and chamber walls are 175 and 25°c, respectively. if the panel is placed in the oven at an initial temperature of 25°c and removed from the chamber at a safe-to-touch tempera ture of 37°c, what is the total elapsed time for the two-step curing operation?
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
Engineering, 28.10.2020 21:20