LISTS

Introduction

SEQUENCE TYPES

The fundamental sequence types: lists and tuples. Both lists and tuples are sequences that can hold various types of data. The difference between lists and tuples is simple:
• List is mutable, which means that a program can change its contents.
• Tuple is immutable, which means that once it is created, its contents cannot be changed.

Lists

A list is an object that contains multiple data items. Lists are mutable, which means that their contents can be changed during a program's execution. Lists are dynamic data structures, meaning that items may be added to them or removed from them. You can use indexing, slicing, and various methods to work with lists in a program.
• List: an object that contains multiple data items
    • Element: An item in a list
    • Format: list = [item1, item2, etc.]
    • Can hold items of different types
• print function can be used to display an entire list
• list() function can convert certain types of objects to lists

Code Ex