Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to do swapping in python without

def swap(xp, yp):
 
    xp[0] = xp[0] ^ yp[0]
    yp[0] = xp[0] ^ yp[0]
    xp[0] = xp[0] ^ yp[0]
 
 
# Driver code
x = [10]
swap(x, x)
print("After swap(&x, &x): x = ", x[0])
 
PREVIOUS NEXT
Tagged: #swapping #python
ADD COMMENT
Topic
Name
8+6 =