7. Lists
So far we have used variables to store a single value. Sometimes it is useful to store multiple values into a single variable using a list.
You can add an item into a list using the append
function
Items in a list can be retrieved as follows:
Python considers the first item in a list to be item 0 (zero), second item to be item 1, and so on.
You can also perform different functions on a list, such as sorting, and finding maximum, minimum and length (number of items):
Last updated