Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 invented

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

ISBN: 3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago