Question: python problem 1) Removing punctuation Write a function remove_punc (text, punc) that takes two string arguments: a string of text that may contain some unwanted

1) Removing punctuation Write a function remove_punc (text, punc) that takes twopython problem

1) Removing punctuation Write a function remove_punc (text, punc) that takes two string arguments: a string of text that may contain some unwanted punctuation, and a string pune that contains one copy of each punctuation character to be removed. remove_pune will return a string that is identical to text, except with any character that appears in punc removed. Hint: Use the .replace string method inside a for loop, to replace each character in punc with an empty string, whenever it appears in text. Examples: >>> remove_punc('Remlove, o?nly th3 exclamati.n points!', '!') 'Remove, only th3 excamati.n points' >>> remove_punc('??Gelt r;!; id of m, o,s,t punctuation', '.!;,?') 'Get rid of most punctuation' Would this function work to remove characters that are not punctuation?

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 Programming Questions!