Lists
Lists are one of the simplest and most important data structures in Python. They can be written as values, or items, separated by commas inside of square brackets, like so:
my_list = [2, 4, 6, 8]
fruits = ['Apple', 'Pear', 'Banana']
empty_lst = []
student_record = ['Bella', 'Math', 98]
One list can include elements of several different types, as shown in the last example.
Lists have some characteristics similar to strings, including indexing, looping, the len()
function, and addition and multiplication operations.
Lists are very flexible. There are many built-in functions and methods you can use to manipulate lists.