Question: Write function remove_duplicate_words(sentence) which takes an input parameter sentence (type string), and returns a string that has all duplicated words removed from sentence. The words
Write function remove_duplicate_words(sentence) which takes an input parameter sentence (type string), and returns a string that has all duplicated words removed from sentence.
The words in the returned string should be sorted in alphabetical order.
For example:
| Test | Result |
|---|---|
| simple_sentence = remove_duplicate_words("hello hello hello hello hello") print(simple_sentence) | hello |
| simple_sentence = remove_duplicate_words("hello hello hi hi hello hi hello hi hi bye") print(simple_sentence) | bye hello hi |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
