Question: How can we use the split() and join() method instead of replace method to solve this problem? We are only allowed split(), join() and not

How can we use the split() and join() method instead of replace method to solve this problem?

How can we use the split() and join() method instead of replaceWe are only allowed split(), join() and not replace

1 Write a function called "replace all" that accepts three Traceback (most recent call las 2 #arguments: File "ReplaceAll.py", line 47, print(replace_all(target, fi 22, new str-target.replace(tar 4 #-target-string, a string in which to search. 5 #-find-string, a string to search for. in 6 #-replace-string, a string to use to replace every instance of the value of find. nd, replace)) File in replace_all "ReplaceAli.??", line 9 #The arguments will be provided in this order. Your function 10 #should mimic the behav 11 #that function in your implementation. Instead, you should 12 #find the result using a combination of split() and join (), 13 or some other method 14# 15 #Hint: This exercise can be complicated, but it can also 16 #be done in a single short line of code! Think carefully about 17 #the methods we've covered. 18 19 of "replace", but you cannot use get string, find_string,replace_s TypeError: "str' object cannot b Command exited with non-zero sta tring) e interpreted as an integer tus 1 2 def replace aintarget sering, find string.replace string) function herel 23 24 25 26 27 28 29 30 32 34 35 #Below are some lines of code that will test your function. 36 #You can change the value of the variable (s) to test your 37 #function with different inputs. 38 # 39 #If your function works correctly, this will originally 40 #print : "In case I don't see ya, bad afternoon, bad evening, 41 and bad nightl" 42 target = "In case I don't see ya, good afternoon, good evening, and good night!" 43 find"good" 44 replace"bad" 45 print (replace_all target, find, replace)) 46 47

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!