# Swap of two two numbers in a list

Problem to swap the two two number in a list. This concept is only applicable for even length of the given array.

## Example-1:

Input : n = [ 3, 2, 0, 1] Output : [2,3,1,0]

## Example-2:

Input : n = [ 5, 7, 4, 3, 8, 6] Output : [7,5,3,4,6,8]

# Solution

n = [ 3, 2, 0, 1] for i in range(0,len(n),2): n[i],n[i+1] = n[i+1],n[i] print(n)

## Output

[2,3,1,0]