In: Computer Science
6.25 LAB: Swapping variables
Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 The output is: 8 3
Your program must define and call the following function. swap_values() returns the two values in swapped order. def swap_values(user_val1, user_val2)
**in Python, please
Python Program :
#Python function swap_values()
def swap_values(user_val1, user_val2):
return user_val2,user_val1
#asking user two integers
x=int(input("Enter integer 1 : "))
y=int(input("Enter integer 2 : "))
#print value of x and y before swap_values function call
print("Before Swap : x : "+str(x)+" , y : "+str(y))
x,y=swap_values(x,y) #call function
print("After Swap : x : "+str(x)+" , y : "+str(y))
***********************************
Screen for indentation :

========================================
Output :