anusha anusha x = 5 y = 10 temp = x x = y y = temp print(‘after swapping: {}’.format(x)) print(‘after swapping: {}’.format(y)) Log in to Reply
Mohd Saif n1,n2=map(int,input(“Enter the value of n1 and n2:”).split(” “)) print(f”Before swapping the value of n1 and n2:{n1},{n2}”) n1=n1+n2 n2=n1-n2 n1=n1-n2 print(f”After swapping the value of n1 and n2:{n1},{n2}”) Log in to Reply
python 3
x = 2
y = 3
x, y = y, x
print(x)
print(y)
python3
a=int(input())
b=int(input())
a,b=b,a
print(a,b)
a=int(input())
b=int(input())
b=a+b
a=b-a
b=b-a
print(a,b)
x = 5
y = 10
temp = x
x = y
y = temp
print(‘after swapping: {}’.format(x))
print(‘after swapping: {}’.format(y))
n1,n2=map(int,input(“Enter the value of n1 and n2:”).split(” “))
print(f”Before swapping the value of n1 and n2:{n1},{n2}”)
n1=n1+n2
n2=n1-n2
n1=n1-n2
print(f”After swapping the value of n1 and n2:{n1},{n2}”)