What are Lists?
- In coding, a list is a data structure used to store an ordered collection of items. Lists are one of the most commonly used data types in many programming languages because they allow for the organization of elements, such as numbers, strings, or other objects, in a single variable.
Creating A List
- To create a list called “aList,” you would write aList = []. This defines an empty list with no elements. If you want to create a list that already contains items, it would look like this: aList = [item1, item2, item3], where each item represents a different element in the list.