Question
Change the function changeStr(lst1,s1,s2) where lst1 is a list of strings, and s1 and s2 are strings so it looks at each element in the
Change the function changeStr(lst1,s1,s2) where lst1 is a list of strings, and s1 and s2 are strings so it looks at each element in the list and checks if the last three letters in the element are the same as those in s1. If the last three characters are the same as s1, it will change the string to replace s1 with s2 and save the element with the changed string. If the element does not end with s1, the original value of the element is kept. This function returns a list with the updated changes. s1 will always be of length 3. The list elements will always be a minimum of length 3
lst 123456 333 2156 111 222333 333133313133 j change Str (lst, 333 a 123456 3332156 1112 22a 333133313133 change Str (lst, 456 a 123a 333 2156 111 222333 333133313133 lsta I' 123456 333 2156 111 222333 333133313133 156 change Str (lst, 456 a 123a. 3332156 111222333 333133313133 156 J change Str (lst, 333 a I' 12:34:56 333 2156 111 222a. 333 133 313133 156' change Str (lst 1156 a I' 123456 3332a 111222333 333133313133 'a JStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started