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
Ajournal bearing has a journal diameter of 3.250 in with a unilateral tolerance of 20.003 in. the bushing bore has a diameter of 3.256 in and a unilateral tolerance of 0.004 in. the bushing is 2.8 in long and supports a 700-lbf load. the journal speed is 900 rev/min. find the minimum oil film thickness and the maximum film pressure for both sae 20 and sae 20w-30 lubricants, for the tightest assembly if the operating film temperature is 160°f. a computer code is appropriate for solving this problem.
Answers: 3
question
Engineering, 04.07.2019 18:10
Ifa component is made of two or more materials with different modulus of elasticity (e), it is called a composite member and we calculate the factor·n". mention the formula for calculating n". also, ifn> 1, explain what will happen to the 1. transformed.gi) ifn 1, what will happen to the material when transformed material when
Answers: 1
question
Engineering, 04.07.2019 18:20
Inspection for bearing condition will include: (clo4) a)-color b)-smell c)-size d)-none of the above
Answers: 1
question
Engineering, 04.07.2019 18:20
Ahe-xe mixture containing a 0.75 mole fraction of helium is used for cooling electronics in an avionics application. at a temperature of 300 k and atmospheric pressure, calculate the mass fraction of helium and the mass density, molar concentration and molecular weight of the mixture. if the cooling capacity is 10 l, what is the mass of the coolant?
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, 25.09.2019 08:30
Questions on the website: 13722363