Link Search Menu Expand Document

Data Types

Table of contents

  1. Description
  2. Example
  3. Built-in Types

Description

A specific category of data. Type defines what values the object can represent, and which actions can be performed on it.

Example

Built-in Types

Below is a table of data types we’ll learn and use most often in class.

Type Principal Type Mutability Order Example
str Sequence Immutable Ordered 'Ruiz', '15'
int Numeric Immutable n-a 5, 10000
float Numeric Immutable n-a 8.9, 900.0
bool Comparison Immutable n-a True, False
list Sequence Mutable Ordered [1,2,3], ['and','or']
tuple Sequence Immutable Ordered (1,2,3), ('and','or)
set Collection Mutable Unordered {1,2,3}, {'and','or}
dict Mapping Mutable Ordered {'flavor': 'sugar', 'frosting': 'almond'}
range Sequence Immutable Ordered range(10)