3. Write a Python program that allows users to search a text file for a specific...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Write a Python program that allows users to search a text file for a specific word, and replace all occurrences of it with their name. • Your program should prompt the user for the word to search for, and their name • Your program should reads the contents of the 'book.txt' file line by line, and replace all instances of the search term with the users name. • Your program should ignore case when searching; if the user searches for 'home'; all instances of 'home' and 'Home' should be replaced. • Your program should save the changes to a new file, called 'output.txt" 4. Test your program. 3. Write a Python program that allows users to search a text file for a specific word, and replace all occurrences of it with their name. • Your program should prompt the user for the word to search for, and their name • Your program should reads the contents of the 'book.txt' file line by line, and replace all instances of the search term with the users name. • Your program should ignore case when searching; if the user searches for 'home'; all instances of 'home' and 'Home' should be replaced. • Your program should save the changes to a new file, called 'output.txt" 4. Test your program.
Expert Answer:
Answer rating: 100% (QA)
Answer Python program is as follow def replacewordwithnameinputfilename outp... View the full answer
Related Book For
Systems Analysis And Design
ISBN: 978-1119496489
7th Edition
Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth
Posted Date:
Students also viewed these programming questions
-
Objective: To develop a program to train executives in negotiation skills. Imagine that you are a partner of Brain Consulting, a consulting firm that offers programs to develop the soft skills of...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In 2012, the average credit score for loans that were purchased through Fannie Mae was 766. A random sample of 35 mortgages were selected, and it was found that the average credit score was 771with a...
-
If the total revenue function for a product is given by R(x) = 60x and the total cost function is given by C = 200 + 10x + 0.1x2, what is the marginal profit at x = 10? What does the marginal profit...
-
Portland Electronics Companys (PEC) president, Marsha Kunselman, is concerned about the prospects of one of the firms major products. The president has been reviewing a marketing report with Jeff...
-
What are the principal differences between the audit of plant assets and current assets?
-
The following defined pension data of Doreen Corp. apply to the year 2012. Defined benefit obligation, 1/1/12 (before amendment) ... $560,000 Plan assets, 1/1/12 ................... 546,200 Pension...
-
Make a statement of shareholders equity based off the following journal entries. The retained earnings are $25,771. 8/1 You filed a charter with the State of Louisiana to form your accounting...
-
The city manager of a large midwestern city was negotiating with the three unions that represented the police, firefighters, and building inspectors over the salaries for these groups of employees....
-
A steel cantilever beam, of length 2L, has an l-section, see Figure Q3. The cantilever beam is under a uniformly distributed load q = 250 kN/m applied in its vertical plane of symmetry at OA part of...
-
What should be the properties of common refrigerants?
-
Classify the fluids based on their properties.
-
Establish relationship between E, K and G.
-
Derive the Bernoullis equation.
-
What are the different types of the efficiency of a turbine? Define each.
-
At the ZZZZ Best Company What is the accounting issue(s) at the core of the problem? At the ZZZZ Best Company was the accounting principle followed correctly or misconstrued by the parties? Why or...
-
Eleni Cabinet Company sold 2,200 cabinets during 2011 at $160 per cabinet. Its beginning inventory on January 1 was 130 cabinets at $56. Purchases made during the year were as follows: February . 225...
-
Describe the best way to validate the content of the use cases.
-
Describe the principal steps in the implementation phase. What are the major deliverables?
-
List the seven types of cohesion. Why do the various types of cohesion range from good to bad? Give an example of good coupling and an example of bad coupling.
-
Oxygen at \(30{ }^{\circ} \mathrm{C}\) and \(300 \mathrm{kPa}\) absolute pressure expands isothermally to an absolute pressure of \(120 \mathrm{kPa}\). Determine the final density of the gas.
-
An important dimensionless parameter concerned with very high-speed flow is the Mach number, defined as \(V / c\), where \(V\) is the speed of the object such as an airplane or projectile, and \(c\)...
-
The "power available in the wind" of velocity \(V\) through an area \(A\) is \[ \dot{W}=\frac{1}{2} ho A V^{3} \] where \(ho\) is the air density \(\left(0.075 \mathrm{lbm} / \mathrm{ft}^{3} ight)\)....
Study smarter with the SolutionInn App