I'm new to python and I'm trying to make a function which is able to detect if a string has the words "I", "I'm", "My", "Was", "Our", "me" replace it with "You", "You're", "Your", "Were", "Your" and "You" and also add a question mark at the end if it did not end with any punctuation. So far I have the code
if ' ' in statement and statement[-1].isalpha() is True:
response = statement
response = response + "?"
return response
but I'm not sure how to make the function seach for those words and replace with their opposites. For example if the statement was "My dog said I'm happy" its response should be "Your dog said you're happy?"
thanks