This program is written in the Python programming language and it swaps the values of two strings "a" and "b". It does this in two steps:
Finally, the program prints both the original strings "a" and "b" and the swapped strings "a1" and "b1" to the console.
a = 'abc' b = 'xyz' print("Before Swap :",a," ",b) a1 = b[:2] + a[2:] b1 = a[:2] + b[2:] print("After Swap :",a1," ",b1)
Before Swap : abc xyz After Swap : xyc abz
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions