Notes / Python / Arrays

Arrays in Python — Revision Notes

A quick-reference cheat sheet: definition, syntax, example, common mistakes and an interview tip.

beginner 📖 2 min revision

Definition

📌 Arrays Python doesn't have a fixed-size array type built directly into the core language the way C or Java do.

Syntax

syntax
myList = [value1, value2, value3]

import array
myArray = array.array('i', [1, 2, 3])  # 'i' = integers only

Example

py
numbers = [10, 20, 30, 40, 50]
for n in numbers:
    print(n, end=" ")

Output

output10 20 30 40 50

Important Points

Common Mistakes

Interview Tip

🎯 Before your interview Be ready to explain that in interviews, "Python array" questions are usually really about list — unless the interviewer specifically means NumPy or the array module.
Back to notes Read full lesson →