Interview Query

Find Mismatched Words

Have you seen this question before?

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.



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


def mismatched_words(string1,string2) -> ["all","is"]
Next question: Restaurant Recommender
Python 3.9.6
Loading editor
Use Shift + Enter to run code