# python demo script to illustrate dictionary usage to replace words in a sentence Input is word pairs exactly with same whitespaces as here: Hi Hello Thanks Thank-you Bye Goodbye (one space between...


# python demo script to illustrate dictionary usage to replace words in a sentence
Input is word pairs exactly with same whitespaces as here:




Hi Hello  Thanks Thank-you  Bye Goodbye


(one space between pairs, two spaces between every pairs)
In a user's input sentence example as follows:


Hi there, Thanks, Bye


using the above given pairs as a dictionary to replace corresponding words in the input sentence, and the output becomes:
Hello there, Thank-you, Goodbye


Read input from user, first word pairs, then the sentence, split, loop over elements to replace what's entered from pair words into entered sentence.
Comments are very important so I can understand. Thanks



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here