human
Give me a code to swapping four variables without temporary variable and the other steps required given the following:
Swapping four variables without temporary variable | Python 3 program to swap 4 variables without using temporary variable ..
swapping a and b variables.
swapping b and c variables.
swapping c and d variables.
initialising variables.
Function call"
How can the above be solved in Python?
assistant
#Here is code to swapping four variables without temporary variable and the other steps required.
 def swap ( a , b , c , d ) :
	a = a + b
	b = a - b
	a = a - b
	b = b + c
	c = b - c
	b = b - c
	c = c + d
	d = c - d
	c = c - d
	print ( " values ▁ after ▁ swapping ▁ are ▁ : ▁ " )
	print ( " a ▁ = ▁ " , a )
	print ( " b ▁ = ▁ " , b )
	print ( " c ▁ = ▁ " , c )
	print ( " d ▁ = ▁ " , d )
a = 1
b = 2
c = 3
d = 4
print ( " values ▁ before ▁ swapping ▁ are ▁ : ▁ " )
print ( " a ▁ = ▁ " , a )
print ( " b ▁ = ▁ " , b )
print ( " c ▁ = ▁ " , c )
print ( " d ▁ = ▁ " , d )
print ( " " )
swap ( a , b , c , d )