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
Aloaded platform of total mass 500 kg is supported by a dashpot and by a set of springs of effective stiffness 72 kn/m. it is observed that when the platform is depressed through a distance x = 12.5 cm below its equilibrium position and then released without any initial velocity; it reaches its equilibrium position in the shortest possible time without overshoot. find the position and velocity of the loaded platform 0.10 sec. after its release. if a further load of 400 kg is added to the platform, find, i) the frequency of damped vibrations, and i) the amplitude of vibration after 2 complete oscillations, given that the initial amplitude is 15 cm.
Answers: 1
question
Engineering, 04.07.2019 18:10
Give heat transfer applications for the following, (i) gas turbines (propulsion) ) gas turbines (power generation). (iii) steam turbines. (iv) combined heat and power (chp). (v) automotive engines
Answers: 1
question
Engineering, 04.07.2019 18:10
Thermal stresses are developed in a metal when its a) initial temperature is changed b) final temperature is changed c) density is changed d) thermal deformation is prevented e) expansion is prevented f) contraction is prevented
Answers: 2
question
Engineering, 04.07.2019 18:10
Items are similar to the free issue items, but their access is limited. (clo5) a)-bin stock items free issue b)-bin stock controlled issue c)-critical or insurance spares d)-rebuildable spares e)-consumables
Answers: 1
You know the right answer?
Pyhtonwrite a function named repeatwords() that takes two string parameters: 1. the name of an input...
Questions
question
English, 16.12.2020 21:20
question
Mathematics, 16.12.2020 21:20
Questions on the website: 13722362