lst = ["a","b","c","d","e","f","g","h","i","j"] n = len(lst) for i in range(0,n-1,2): lst[i],lst[i+1] = lst[i+1],lst[i] print(lst) print(n)