Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

swap list items in python

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)
 
PREVIOUS NEXT
Tagged: #swap #list #items #python
ADD COMMENT
Topic
Name
9+4 =