Subtopic Notes

H - 2D Arrays

Preq. Programming Basics

2D Arrays

  • Type of array where each element is itself an array
  • Can be visualized as a table with rows and columns
  • Ideal for representing grid-like structures such as matrices, game boards or spreadsheets
  • It consists of multiple rows and columns, where each element is uniquely identified by its row and column values.
  • Applications: Images, screens and game boards

Example

A 2D array to store student grades for 4 subjects and 3 students.

Student 1Student 2Student 3
Physics909179
Chemistry805060
Maths826775
Computer Science789295

This can be represented in Python as the following

PYTHON

Python can be executed directly in the browser.

Editor — Python
Output
No output yet.

PSEUDOCODE

Pseudocode uses basic Cambridge-style keyword highlighting. Execution is not supported yet.

Editor — Pseudocode