Question: Python Exercise Replace Objectives: Practice string manpulation with loop. Write a function, named replace, that has three parameters: (1) a string named original, (2) a

Python
 Python Exercise Replace Objectives: Practice string manpulation with loop. Write a

Exercise Replace Objectives: Practice string manpulation with loop. Write a function, named replace, that has three parameters: (1) a string named original, (2) a single-character string, named old, representing the character to be replaced, (3) another single- character string, named new, representing the character to be used for replacement. The function should return a new string where every occurrence of old in the passed-in string is replaced by new. You should write a loop to implement such a functionality. You might want to use the following test cases: Function cal Return value "He**o replace ("Hello", "1",*) replace ("this is a test","," ") replace ( " " , "X", "y") replace ("no change", "i"" "this is_a_test" "no change

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!