def replace1(x):
str = 'hi' + x[1:len(x) - 1] + 'hi'
return str
Function Call | Return Value | |||
---|---|---|---|---|
replace1('hello') | → | |||
replace1('goodbye') | → | |||
replace1(' world ') | → | |||
replace1('') | → | |||
replace1(' ') | → | |||
replace1('oof') | → |
Experiment with this code on Gitpod.io