Computer Science, asked by priyarana428, 11 months ago

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 Anonymous286
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