Spent some time scribbling about Python lists today.
Python lists can hold values of mixed data type. They can be fully manipulated and any element can be called from the list at will.
Creating a list is as simple as putting comma-separated values between square brackets.
mylist = [1,2,3,4,5]
Now playing around with lists is fun. Here are methods to add & remove items.
Adding an item to the end of the list.
mylist.append(item)
Insert an item at a given position by specifying the index value.
mylist.insert(index,item)
Remove the first occurrence of an item in the list.
mylist.remove(item)
Remove the item at the given position (index). If no index value is specified, i.e using mylist.pop() then the right-most item is removed which is also the last index.
mylist.pop(index)
Return index of first occurrence of the given item.
mylist.index(item)
Count number of occurrences for given item.
mylist.count(item)
Sort items of the list in place.
mylist.sort()
Reverse elements of the list.