Lists
Lesson
Lists
- Data structure
- Lists contain elements, which can be of any type
- Access elements using the following syntax: listName[index]
Zero-based Indexing
- The first element of a list is referenced using an index of zero.
- Examples:
- listName[0] gives the first element
- listName[3] gives the fourth element
The range() Function
- Creates a list of numbers
- Use with the following syntax: range(start, stop) OR range(stop) if you would like to start counting from 0
- Counts by 1 from the start value and ends just before the stop value
Playground