Arrays
Python lists are general-purpose sequences. The standard-library array module stores values of a chosen basic type more compactly for some numeric tasks.
Understand the idea
An array's type code determines which values it accepts and how they are stored. It is not the same as a NumPy array with vectorised mathematics and shape rules. Choose from the actual data and performance requirements rather than calling every sequence an array and assuming identical operations.
Where to try it
Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.
A worked example
from array import array
counts = array("i", [12, 8, 5])
counts.append(3)
print(list(counts))
print(counts.typecode)
Read the result
The output is [12, 8, 5, 3] followed by i.
Try one change
Try appending text in a separate run and inspect the specific type error.