Tuple vs Array
A tuple is a small, fixed group where each spot has a meaning, like x and y. An array, or list, is a row of items of the same kind that can grow and change.
Tuple
A small, fixed group of values in order. It usually cannot be changed.
A tuple is a small, fixed group of values kept in order. Once made, it usually cannot be changed. Each spot often means something, like the x and y of a point. Python writes a tuple with round brackets, like (3, 4). A function can return a tuple to hand back two or three values at once.
Array
A row of values kept together under one name. Each sits in a numbered spot.
An array is one value that holds many values in a row. Each item sits in a numbered spot, and the count starts at zero. You can add items, take them out, sort them or go through them one by one. Python calls its array a list. Arrays are the most common way to keep many things of the same kind together.
In one line
- Tuple
- A small, fixed group of values in order. It usually cannot be changed.
- Array
- A row of values kept together under one name. Each sits in a numbered spot.