Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Oct 18, 2021
Embed
What would you like to do?
def swap(list_, a, b):
list_[a], list_[b] = list_[b], list_[a]
names = ["Aman", "Kharwal", "Sajid", "Akanksha"]
print(names)
swap(names, 2, 3)
print(names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment