I am trying to replace any i's in a string with capital I's. I have the following code:
str.replace('i ','I ')
However, it does not replace anything in the string. I am looking to include a space after the I to differentiate between any I's in words and out of words.
Thanks if you can provide help!
The exact code is:
new = old.replace('i ','I ')
new = old.replace('-i-','-I-')
replacedoesn't mutate the string in place. You have to assign the replaced string to the variable.new, notold? 2) What is the actual input and the actual output for each case? (Surely not every case doesn't change anything!)