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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 07:30, kimhoss2
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
image
Computers and Technology, 23.06.2019 22:50, atifgujar
An environmental protection agency study of 12 automobiles revealed a correlation of 0.47 between engine size and emissions. at 0.01 significance level, can we conclude that there is a positive association between the variables? what is the p value? interpret.
Answers: 2
image
Computers and Technology, 24.06.2019 13:00, naomirice24
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x, y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
image
Computers and Technology, 24.06.2019 21:30, croxy0514
Jenny wants to create an animated short video to add to her website. which software will she use to create this animated video?
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 in other subjects:

Konu
Social Studies, 23.10.2020 21:40
Konu
English, 23.10.2020 21:40
Konu
Mathematics, 23.10.2020 21:40