Write a program to swap two numbers without using a third variable.
x = 10
y = 11
print(f'Before swapping x is {x} and y is {y}.')
x = x + y # 21
y = x - y # 10
x = x - y # 11
print(f'After swapping x is {x} and y is {y}.')
Study more about Python at Python Class 10
1.5k questions
1.4k answers
4 comments
12.3k users