Question: solve using python3 Question-3: Write a function called slicing_function that takes two strings of equal length and an integer as arguments. The integer denotes where
solve using python3
Question-3: Write a function called slicing_function that takes two strings of equal length and an integer as arguments. The integer denotes where "crossing" should take place. You should return the strings after they have been crossed. Finally, print the answer as shown below. Function call 1: slicing_function("abcd", "xypz",2) Sample Output 1: ('abpz', 'xycd') Explanation 1: In sample input 1, the crossing point is at 2. So the strings should cross after the 2nd value i.e. index 1. So, in the answer abpz means the first 2 letters are from abcd and the last 2 from xypz. Similarly, xycd means the first 2 letters are from xypz and the last 2 from abcd. Function call 2: slicing_function("ppp", "itt", 1) Sample Output 2: ('ptt', 'tpp) Explanation 2: In sample input 2, the crossing point is at 1. So the strings should cross after the 1st value i.e. index 0. So, in the answer ptt means the first value is from the string ppp and the rest from ttt. Similarly, tpp means the first value is from ttt and the later ones from ppp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
