Skip to content

Instantly share code, notes, and snippets.

@Ventsislav-Yordanov
Last active January 27, 2018 04:24
Show Gist options
  • Save Ventsislav-Yordanov/e8aff8283307e093083ec24a3607a743 to your computer and use it in GitHub Desktop.
Save Ventsislav-Yordanov/e8aff8283307e093083ec24a3607a743 to your computer and use it in GitHub Desktop.
# Add values to a list
fruits.append("peach")
fruits # ["pineapple", "apple", "lemon", "strawberry", "orange", "kiwi", "peach"]
fruits = fruits + ["fig", "melon"]
fruits # ["pineapple", "apple", "lemon", "strawberry", "orange", "kiwi", "peach", "fig", "melon"]
# Change values from a list
fruits[0:2] = ["grape", "mango"]
fruits # ["grape", "mango", "lemon", "strawberry", "orange", "kiwi", "peach", "fig", "melon"]
# Delete values from a list
fruits.remove("mango")
fruits # ["grape", "lemon", "strawberry", "orange", "kiwi", "peach", "fig", "melon"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment