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, 23.06.2019 01:10
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Hey i just logged on and one of the moderators deleted a bunch of my answers to questions, even though the answers were right and the people it doesn't make sense but if anyone wants to talk about anything just message me lol (this is super random lol)
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
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
Mathematics, 12.02.2021 17:40
question
Mathematics, 12.02.2021 17:40
question
Mathematics, 12.02.2021 17:40
Questions on the website: 13722367