Lists
results = ["Mario", "Luigi", "Daisy"]
List Methods
You can add on to a list using .append()
. This always appends to the end of the list.
results.append("Princess")
You can also add a list onto a list.
results.append(["Bowser", "Donkey Kong"])
You can remove items from a list.
results.remove("Bowser")
If you want to append a list with all elements of another list, you can use .extend()
results.extend(["Bowser", "Donkey Kong"])
You can insert an item with it’s intended index and the item itself.
results.insert(0, "Bowser")
You can reverse a list using .reverse()
.
results.reverse()