Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started