Programming with Python- Arrays
Arrays are a data structure which can hold a number of items / elements.
Each item / element of an array can be accessed by referring to its index number in the array.
furniture = ["table", "sofa", "chair", "bed"]
Here, we have an array called furniture, which stores the names of different items of furniture 🪑🛏.
The first item of the array is stored at index 0, and has value "table".
This would print "table".
We can also change the value of an item, by setting it to something else.
furniture = "armchair"
This would change the item located at index 2 ("chair"), to "armchair".
Let's say we have already created our array. We can add it to by appending a value.
This would add the item "coffee table" to the end of the array.
Have a go at creating different arrays in Python