Skip to content

Instantly share code, notes, and snippets.

@rwp0
Last active February 28, 2024 21:20
Show Gist options
  • Save rwp0/d9adeb0e3a0272a33aa893ee068982fb to your computer and use it in GitHub Desktop.
Save rwp0/d9adeb0e3a0272a33aa893ee068982fb to your computer and use it in GitHub Desktop.
Python Data Types

Python Data Types

Composite ones with literal syntax

Ordered and Non-unique

And also slower in large datasets

List

list =  [1, 2, 3] # Constructor: list

Tuple

tuple = (1, 2, 3) # Constructor: tuple

Unordered and Unique

Faster because of the hash function

Dictionary

dict = {key1: 'value', key2: 'value2', key3: 'value3'}

Set

set = {1, 2, 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment