Although lists and arrays are not the same thing, with Python, we use both words interchangeably. The WHY, is not important at this point 😊

When we assign a variable , we are able to store, retrieve and change 1 single item of data.

fruit = "Apple"

A list (or an array) is a data structure that allows us to store more than one item of data.

fruit = ["Apple", "Orange", "Pear", "Banana"]

<aside> 💡 Key points to create an array

</aside>

Indexing list items

Items are all indexed in a list and can be accessed separately.

Untitled

We can either print a whole list out to the screen or individual items.

If I want to print an individual item, I will refer to item using square brackets. For example, the apple is the first item so I would write fruit[0].

https://replit.com/@bitFez/listsex1#main.py

Adding Items to a List

In order to add items to a list, we need to use the append() function.