**Programming** Examples

# Python program to swap two values using tuple assignment

Write a program to swap two values using tuple assignment

`Solution`

```
a = int(input("Enter value of A: "))
b = int(input("Enter value of B: "))
print("Value of A = ", a, "\n Value of B = ", b)
(a, b) = (b, a)
print("Value of A = ", a, "\n Value of B = ", b)
```

`Output`

Enter value of A: 54

Enter value of B: 38

Value of A = 54

Value of B = 38

Value of A = 38

Value of B = 54