I'm using python 3 and I just want to use only an efficient and effective single line of code for the following problem.
Suppose, I have a word and it has multiple combinations. I want to replace all the combinations with an efficient single line of code. For example,
s2 = 'Hello Donald. DONALD is playing with his son. His son loves to play with donald'
s2.replace('Donald', 'John')
This replaces only Donald not DONALD and donald.
How can I replace all combinations ( Donald, DONALD, donald ) of Donald by John.
More explicitly :
s3 = 'NO No nO no'
I can use
s3.replace('NO', 'yes').replace('No', 'yes').replace('nO', 'yes').replace('no', 'yes')
But, the more combinations, the more replace functions. How can I use replace function effectively and efficiently to replace all combinations NO by yes.