subject

First, we will explore some of methods from the str class. a) join during the last assignment you made a function that echoed a string several times with a seperator between each repetition. here we will achieve a similar goal through the use of the join) method of the str class. 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, seperating each one by separator below we define a a list my_list. use the join) method on the string you define as separatoro join the elements in my_list seperated by the-character. save the output to a new variable called joined string .the output should look as follows: python-is-so-much-fun in [ ]: # this variable provided for you my_list'python','s',so'much'fun' # your code here raise notimplementederror) 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 ucsd if you are unsure how use replace you can run str. replace? to look at documentation. note that using replace returns a new string that you need to assign to a variable if you want to keep a reference to it ( replace is not 'inplace) for this question, overwrite statement as the assignment to the output of the replace call in [ ]: # this code provided for you statement'ucla is the best uc in southern california. # your code here raise notimplementederror) 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 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 in [ ]: # this variable provided for you excessive exclamation is the best! i # your code here raise notimplementederror in assert 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 too_much to be the ouput of calling replace on too_much, so that you are replacing too_much with it's updated version every time. in [ ]: # this variable provided for you too-much '1, think th@at11 punctuation may ? > > be the bes$$$t thing thats: ever! been l invented 111 111. = : # your code here raise notimplementederror) in assert isinstance (too much, st) assert too_muchi think that punctuation may be the best thing thats ever been invented

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
You have read about the beginnings of the internet and how it was created. what was the internet originally created to do? (select all that apply) share research. play games. communicate. share documents. sell toys
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion is this and example of
Answers: 1
You know the right answer?
First, we will explore some of methods from the str class. a) join during the last assignment you ma...
Questions
question
History, 19.09.2019 03:40