0
What is the error
def highlight_word(sentence, word): lst = [] lst = sentence.split() if word in lst: idx = lst.index(word) lst[idx] = lst[idx].upper() new += ' '.join(lst) return new print(highlight_word("Have a nice day", "nice")) print(highlight_word("Shhh, don't be so loud!", "loud")) print(highlight_word("Automating with Python is fun", "fun"))
2 odpowiedzi
+ 2
The line : new += ' '.join(lst). Remove the + operator
new = ' '.join(lst)
+ 1
@Justus thanks for help