Data Types
Table of contents
Description
A specific category of data. Type defines what values the object can represent, and which actions can be performed on it.
- Python Docs: Built-in Types
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) |