def swap(x, y):
mylist[x] = mylist[y]
mylist = ["a", "b", "c", "d"]
swap(2, 3)
print(mylist)
So i need to swap two elements in the list with each other but in my code it only replaces not swap. for example it will output as "a b d d" when it shouldn't repeat the same letter twice. it should output as "a b d c" Any helpers?