Question: Write an algorithm for performing the Odd Even Swapping? Create an user defined function in python program to perform the Odd Even Swap operation? Note:
Write an algorithm for performing the Odd Even Swapping? Create an user defined function in python program to perform the Odd Even Swap operation? Note: oddevenswap(1.52) produces a string such that the letters occurring in the odd positions of S1 are replaced by the letters occurring in the corresponding even positions of S2. Similarly, the letters occurring in the even positions of S1 are replaced by the letters occurring in the corresponding odd positions of sz. In the above example, after a certain stage. If there is no even-position letters in S2 to replace the odd-position letters in S1, those odd. position letters are left unreplaced. Similarly, after a certain stage. If there is no odd- position letters in 52 to replace the even-position letters in S1 those even position letters are left unreplaced. For Example oddevenswap(abcd, efgh)= fehg, oddevenswap(ab,efgh-te, oddevenswap(abcd,fg)= gfcd. Here also oddevenswap(S1, S2) need not be same as that of oddevenswap(52,51). Input Format Accept two strings as parameter to the user-defined function from the user Output Format The modified string after performing oddevenswap
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
