The highlight_word function changes the given word in a sentence to its upper-case version. For example, highlight_word("Have a nice day", "nice") returns "Have a NICE day". Can you write this function in just one line?
Answers
Answered by
3
Answer:
def highlight_word(sentence, word):
return(sentence.replace(word,word.upper()))
Explanation:
You use the replace method to first find the word and then replace with its capitalised version using the upper method
Hope it Helps
Similar questions