Bits and Bytes and Data Types

Start at the bottom and work your way up.

levelDescription
objects and
data Structures
You can think of these as an individual "thing" that can contains collections, data structures, data types, ...

Note: You can have a list (collection) of objects and data structures.
collection of
data types
For example:
  • lists
  • tuples
  • dictionaries
  • etc.

You can think of these collections containing individual "things" that have something in common. (e.g. age, height, etc.)
collection
of bytes
One byte is to small, so we use several adjacent bytes (collection of bytes) as a "thing". (A data type.)
  • some collections are manipulate as numbers (add, subtract, etc.)
  • some collections are "officially" assigned to represent text characters (A, B, etc.)
  • some collections are used in other ways

Collections of bytes are used as data types in programming languages. For example:

  • integer
  • float
  • string
  • set
  • boolean
  • etc.
FYI: Computer instructions (programs) at the hardware level are just collections of bytes. (i.e. Commands and data are indistinguishable. It is just a matter of how they are used.)
We are now entering the realm of programming languages.
bytes as
decimal numbers
Bits in bytes are difficult for humans to use, so we assign the number 0 to 255 to bytes. Number are easier to think about and logically manipulate.

The numbers 0-255 are the conversion to decimal (base 10) of the bits (base 2) in a byte.
bytes
8 bits. This is the smallest unit of memory. Each byte in memory is addressable by a unique address starting at zero (0).

Note: The industry has settled on 8 bit bytes as the standard. However, in the past I have worked on a computer that had 9 bit bytes.
bits
A bit in hardware is a circuit that is either ON or OFF. We (humans) assign the numbers 0 and 1 to bits.

For some Python code examples click HERE .

For examples of bytes and UTF-8 characters click HERE .