In the previous blog, we saw  how to find the ASCII value of the character in python. Now, we will see how to swap two numbers in python.

Sample input:-

10 50

Sample output:-

50 10

Program :-

num1 = int(input())
num2 = int(input())
print("Before swaping",num1,num2)
num1,num2 = num2,num1
print("After swaping",num1,num2)

Algorithm:-
1.Start 
2.Get the input of two numbers
3.print statement is used to print the numbers before swapping 
4.After that swapping takes place.
Explanation:- num1,num2 = num2,num1 this means num1 takes the value of num2 and similarly num2 takes the value num1.
5.Finally print the num1 and num2 after swapping.
9.Stop 

Screenshot:-

1.Program Screenshot:-



2.Code Screenshot:-



In next blog we will see how to check if two numbers are equal or not.