Find Mismatched Words

Start Timer

0:00:00

Upvote
6
Downvote
Save question
Mark as completed
View comments (19)

You are given two sentences as strings. Create a function that returns a list of all words that are not in both sentences.

You can assume that the sentences have no punctuation marks, extra tabs, or spaces.

Note: The strings "Game" and "game" should be considered the same word. Because of this, make sure all the strings in the list you output are in lowercase.

Example:

Input:

string1 = "I want to eat fish today with my friends"
string2 = "All I want is to eat fish today with my friends"

Output:

def mismatched_words(string1,string2) -> ["all","is"]
.
.
.
.
.


Comments

Loading comments