Note that Arrays are not built-in to Python, but Python Lists can be used instead.
cars = ["Ford", "Volvo", "BMW"]
Try it here
Note: This page demonstrates how to use LISTS as ARRAYS in Python; however, to deal with arrays in Python, you must first import a library, such as NumPy.
Multiple values are stored in a single variable using arrays:
What exactly is an array?
An array is a type of variable that can hold several values at once.
If you have a list of objects (for example, a list of automobile names>
, you could store the cars in separate variables like this:
car1 = "Ford"
car2 = "Volvo"
car3 = "BMW"
But what if you want to search through all of the automobiles to find a specific one? What if you had 300 cars instead of three?
The answer is an array!
Many values can be stored in an array with a single name, and the values can be accessed by referring to an index number.