Question: 3. Write a Python program that allows users to search a text file for a specific word, and replace all occurrences of it with
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.
Step by Step Solution
3.26 Rating (144 Votes )
There are 3 Steps involved in it
Answer Python program is as follow def replacewordwithnameinputfilename outp... View full answer
Get step-by-step solutions from verified subject matter experts
