Learn practical skills, build real-world projects, and advance your career

basic coding

Swapping

Swapping
Description
You are given two integer variables, x and y. You have to swap the values stored in x and y.


Input:
Two numbers x and y separated by a comma.

Output:
Print 5 lines. The first two lines will have values of variables shown before swapping, and the last two lines will have values of variables shown after swapping. The third line will be blank.


in_string=input()
my_list = in_string.split(',')

x = int(my_list[0])
y = int(my_list[1])


print('x before swapping: {0}'.format(x))
print('y before swapping: {0}'.format(y))


z=x
x=y
y=z

print()



print('x after swapping: {0}'.format(x))
print('y after swapping: {0}'.format(y))