Question: In python, How can i pull words from a . txt file to modify user input. Ex . The . txt file contains the words

In python, How can i pull words from a .txt file to modify user input. Ex. The .txt file contains the words lion and rabbit. When the user types a sentence such as,"i went to the zoo and saw a lion and rabbit." The code will recognize those words and change them to something else such as tiger and fox. So when the user sentence is returned it will instead be, "i went to the zoo and saw a tiger and a fox." Please show example in detail.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!