Question: Python program Write a function called chop_string that takes two strings S and A as parameter and returns a string where each occurrence of the
Python program
Write a function called chop_string that takes two strings S and A as parameter and returns a string where each occurrence of the string is A is chopped from S. Do not remove any punctuation or space from any string. Also, matching should be case sensitive. Function definition: def chop_string(S,A): Sample Input: print(chop_string('abc cde','cc')) Output: abc cde Explanation: 'cc' is not in the string abc cde', hence cannot be removed. So original string is returned. Sample Input: print(chop_string('abc cde','c c')) Output: abde Sample Input: print(chop_string('funny bunny,'nn')) Output: fuy buy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
