Previous Module
Next Module

COMPUTER SYSTEMS: Encoding and compression

COMPUTER SYSTEMS: Network topologies

COMPUTER SYSTEMS: Wired and wireless networks, protocols, and layers

COMPUTER SYSTEMS: Threats to computer systems and networks

COMPUTER SYSTEMS: Operating systems and utility software

COMPUTER SYSTEMS: Impact of technology on society

ALGORITHMS AND PROGRAMMING: Types of data

ALGORITHMS AND PROGRAMMING: Producing robust programs

ALGORITHMS AND PROGRAMMING: Designing, creating, and refining algorithms

ALGORITHMS AND PROGRAMMING: Programming languages

  • 1D arrays: store one list of items (e.g. names, scores)

# 1D array

names = [“Kai”, “Toby”, “Adika”]

print (names[1]) # Kai

  • 2D arrays: are arrays within arrays – like a table (rows and columns). 2D arrays are useful for emulating database tables (rows = records, columns = fields). Remember that the first row and column will be indexed as 0.

# 2D array

students = [

[“Kai”, 16, “A”]

[“Toby”, 17, “C”]

[“Adika”, 16, “B”]

]

print (students[0][2]) # A

Unlock Arrays (lists)

Subscribe to SnapRevise+ to get immediate access to the rest of this resource.

Premium accounts get immediate access to this resource.

Previous Module
Next Module