Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am confused on how to do part d) in this problem, it is python. c) replace for dropping characters Use the replace method to
I am confused on how to do part d) in this problem, it is python.
c) replace for dropping characters Use the replace method to remove all the exclamation points in the string excessive. Assign the output of doing this to a variable called fixed . Hint: you can drop characters with replace by 'replacing' them with an empty string. ]: \# This variable provided for you excessive = 'using!!! excessive!!! exclamation points!! is the best!!!!!!' \# YOUR CODE HERE raise NotImplementedError() ]: lassert isinstance(fixed, str) assert fixed == 'using excessive exclamation points is the best' d) Clearing all punctuation with replace Now we want to generalize what we did in 'c)' to remove all punctuation using the replace ( ) method. Write a for loop to loop over every character in string.punctuation. Inside the loop, call replace on too much with the current punctuation character to remove it, like we did in 'c)'. To do this, inside the loop, re-assign to be the ouput of calling , so that you are replacing with it's updated version every time. \# This variable provided for you too_much = 'I, think thlat!! punctuation... may?>> be the bes $t th!ing thats : ever! been! invented!!!!!!' \# YOUR CODE HERE raise NotImplementedError() assert isinstance(too much, str) assert too_much = 'I think that punctuation may be the best thing thats ever been inventedStep 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