Monday, July 27, 2020

Write a Program to swap two variables in Python.

swap two variables in Python.


m = input('Enter value of m : ')  
s = input('Enter value of s : ')  

temp = m  
m = s  
s = temp  
  
print('The value of x after swapping :: {}'.format(m))  
print('The value of y after swapping :: {}'.format(s))  

OUTPUT

Enter value of m : 5
Enter value of s : 4

The value of x after swapping :: 4
The value of y after swapping :: 5


No comments:

Post a Comment

Please do not any spam link in Comment Box