1.

Write a program to swap two values using tuple assignment Program to swap two values using tuple assignment

Answer»

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



Discussion

No Comment Found