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 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
question
Computers and Technology, 22.06.2019 22:40
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
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, 05.10.2019 05:30
question
Mathematics, 05.10.2019 05:30
question
Biology, 05.10.2019 05:30
Questions on the website: 13722362