Question: Python, please help. Words in a file: color or colour? Run Terminal Save Mark E Problenm You're reading a book by an unfamiliar author and

Python, please help.

Python, please help. Words in a file: color or colour? Run Terminal

Save Mark E Problenm You're reading a book by an unfamiliar author

Words in a file: color or colour? Run Terminal Save Mark E Problenm You're reading a book by an unfamiliar author and are curious about which country they might be from. You decide to write a program to help you guess this based on the spelling of the words in the book. program.pybook.txt flopen ("book.txt") booksfl.reado.split) while True: strinput("Word to look for: ") if str Write a program that reads in a word (e.g.colour or color) and checks if it occurs in the file book.txt, printing out was found in the book. or was not found in the book. continue if str in books: print("[ was found in the book.".format (str)) break For example, given the book.txt file: else: print(" was not found in the book.".format (str)) continue He Looked out from the top of the mountain The colour of the sky was amazing . Reds oranges and pinks faded into a hazy blue. fl.closeC) then your program should work like this: Word to look for: colour colour was found in the book. Submissions Output The provided input word will always be in lowercase, but your program should match in a case insensitive manner. For instance, given the following book.txt file: #12 Not yet! Failed a test (2 tests passed). Testing the first example in the question. Testing the second example in the question. Testing a case where the word does not occur in the text. Your submission attempted to read too much input! This occurred on line 5 of program. py a few seconds ago Load txt Hypothesize? How was she going to form a hypothesis when she didn't even know what the rest of the data looked like? EAutosaved a few seconds agoLoad then your program should work like this: #11 Not yet! Failed a test (2 tests passed). an hour ago Load Word to look for: hypothesize hypothesize was found in the book Testing the first example in the

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 Databases Questions!