in my code I have this line which return a string
return item.title().lower()
item is an object, with a title, and we return that string title but in all lowercase.
How can I do something like
return item.title().lower() but if the words (Maxine, Flora, Lindsey) are in that title, keep them uppercase. All the other words, do lowercase
I can use an if statement but I'm not really sure how to capitalize only specific words.
like
names= ("Maxine", "Mrs. Lichtenstein", "string3")
if any(s in item.title() for s in names):
return ???
would something like that work? And what could I return?