Data types

Computers store information as binary 1’s and 0’s.  These are known as bits.  Groups of 8 bits are bytes.  Ultimately, whatever data we store in volatile (primary) storage (RAM, Cache, Registers) and non-volatile (secondary) storage (HDD, SSD,…) they are stored as bits.  We can’t easily understand data stored in bits, we understand decimal numbers, letters, and words.  So we use data types to organise these.  In programming terms we store these in variables and constants, when we store these permanently we may use a database.

Simple Data Types

Simple data types are single pieces of data.  Integers are whole numbers (no decimal point), floats have a decimal point.  These numbers can be positive or negative.  Boolean is true or false (yes or no, 1 or 0).

Complex Data Types

Complex data types contain more than one piece of data, these are also known as arrays (the array we commonly use in Python is known as a List).  Any word stored in memory such as “car” is a string, a string is an array of characters.

012
car

A string can be thought of as a one-dimensional array, but other one-dimensional arrays can contain any data types.  These operate in the same way. Below is an array of real (float) numbers.  A typical one-dimensional array does not require a null termination like a string does.

Arrays/lists have indices – numbers that identify the position of each piece of data. It always starts at 0. Below in indice (index/position) 1 is the value 23.56.

012
45.5623.56999.80

See the Python Methods Lists have available https://www.w3schools.com/python/python_lists_methods.asp

Year 12 see two-dimensional arrays and Dictionaries.