】寻找字符串"I think hope is a good thing."中字符串"hope"的下标,并将字符串中的hope替换成freedom,将新字符串保存到变量result中并在屏幕上输出。(使用replace方法)
str = "I think hope is a good thing." print(str.find("hope")) result = str.replace("hope","freedom") print(result)