subject

A) join During the last assignment you made a function that echoed a string several times with a separator between each repetition Here we will achieve a similar goal through the use of the joint method of the str dass When Join() is called on a str object (let's call it separator) with a list as its argument, it joins the elements of the list separating each one by Separator Below we define a a list wy_list Use the join() method on the string you define as separator" to join the elements in my list separated by the character Save the output to a new variable called foined_string The output should look as follows: "Python is so much fun! In [ ]: # This variable provided for you my_list - ['Python', 'is', 'o', 'much', 'fun) # YOUR COOE MERE raise Not ImplementedError() In [ ]: assert Isinstance(Joined_string, str) assert joined string -- "Python is so much fun! B) replace Now try to use the replace method to update the string statement such that it replaces UCLA to UCSO If you are unsure how use replace you can run str. replace to look at documentation, Note that using replace retums a new string that you need to assign to a variable if you want to keep a reference to replace is not implace") For this question, overwrite statement as the assignment to the output of the replace call In [ 1 # This code provided for you statement - UCLA is the best UC in Southern California # YOUR CODE HERE raise Not ImplementedError() In [ ]: assert Isinstance(statement, str) assert statement UCSD is the best UC in Southern California."
C) replace for dropping characters Use the replace method to remove all the exclamation polnts 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 In [ ]: This variable provided for you excessive - using exclamation point is the best 111111 β€’ YOUR CODE HERE raise NotImplementedError() In [ 1 assert isinstance(fixed, ste) assert fixed using excessive exclamation points is the best!
D) Clearing all punctuation with replace Now we want to generalize what we did in 'cy to remove al punctuation using the replace() method Write a Por 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 'cy To do this, inside the loop, re-assign too_much to be the output of calling replace on too much so that you are replacing too much with its updated version every time. In 1: This variable provided for you too much 1, think that punctuation... may be the bes$$$t thing that has ever been invented111111 # YOUR COOE MERE raise Not ImplementedError() In ( 1: assert isinstance(too much, str) assert too much I think that punctuation may be the best thing that has ever been invented

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
Write a program that uses a widgetviewer object to do the following: generate two random integers between 1 and 9 (inclusive). name one of them x, the other y. display them to the user using jlabel objects. create a jlabel object displaying the text "enter an operation number." create a jtextfield for the user's input. create a jbutton displaying the text "press here when you've entered your operation." use addandwait to add it to the widgetviewer object. when the user clicks the jbutton, evaluate operation in the following order to determine the one and only mathematical operation to perform on x and y. use a jlabel to display the result. if operation is between 1 and 10 inclusive, add x and y. if operation is evenly divisible by 4, subtract y from x. if operation is evenly divisible by 5, use integer division to divide y into x. if operation is an even number, use floating point division to divide y into x. if none of the other tests on operation apply, multiply x and y. note: operation can be negative or zero.
Answers: 2
question
Computers and Technology, 24.06.2019 12:30
Do you think media is stereotype ? and why?
Answers: 1
question
Computers and Technology, 25.06.2019 03:30
Kou converged his word document to a powerpoint document. when he received the powerpoint, he was missing material. which most likely explains why the material was missing? a it did not have a proper heading b he incorrectly copied and pasted it c he did not save his document properly d there was not enough space in powerpoint
Answers: 1
question
Computers and Technology, 25.06.2019 07:00
The graph shows the number of chapters sarah read in a book each day of a week
Answers: 1
You know the right answer?
A) join During the last assignment you made a function that echoed a string several times with a sep...
Questions
question
Mathematics, 15.12.2020 22:30
question
Social Studies, 15.12.2020 22:30
question
Business, 15.12.2020 22:30
question
Mathematics, 15.12.2020 22:30