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 programPython program Write a function called chop_string that takes two strings S

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

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!