Create a function to swap values of a pair of integers in python
Answers
Answered by
0
Python program to swap two variables:
//To take input from the user
//x = input('Enter value of x: ')//y = input('Enter value of y: ')
x = 5y = 10
//create a temporary variable and swap the valuestemp = xx = yy = temp
print('The value of x after swapping: {}'.format(x))print('The value of y after swapping: {}'.format(y))
//To take input from the user
//x = input('Enter value of x: ')//y = input('Enter value of y: ')
x = 5y = 10
//create a temporary variable and swap the valuestemp = xx = yy = temp
print('The value of x after swapping: {}'.format(x))print('The value of y after swapping: {}'.format(y))
Aishwarya98:
mark me as brainliest
Answered by
0
Answer:
x=50
y=40
tem=x
x=y
y=tem
print("value of x:",x)
print("valueofy:",y)
Explanation:
Similar questions