Untitled
unknown
python
2 years ago
149 B
7
Indexable
def swap(lst):
for i in range(0, len(lst)-1, 2):
lst[i], lst[i+1] = lst[i+1], lst[i]
list=eval(input())
swap(list)
print(list)
Editor is loading...
Leave a Comment
def swap(lst):
for i in range(0, len(lst)-1, 2):
lst[i], lst[i+1] = lst[i+1], lst[i]
list=eval(input())
swap(list)
print(list)