I have a string 'A,B' which is separated by , or and
The String could have several words like 'A,B,C'. It may be 3 or 4 words and more.
Now I need to replace , with or. Any and should not be replaced.
Give an example string 'A,B,C and D' . My expected result is A or B or C and D
My attempt:
str1 = 'A,B,C and D'
str1.replace(',', ' or ')
Is this the correct method?