Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created October 18, 2021 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/0dac60f848ec8bbd9b1d39c4fce04f7d to your computer and use it in GitHub Desktop.
Save amankharwal/0dac60f848ec8bbd9b1d39c4fce04f7d to your computer and use it in GitHub Desktop.
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