Created
September 19, 2019 13:53
-
-
Save techstackmedia/18f6f8e3b2c304e47e1c01abbee2066d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Primitive Data Structures (Types) | |
# All Primitive Data Types are Immutable Objects | |
int_ = 5 # int - Immutable Object | |
float_ = 5.25 # float - Immutable Object | |
complex_ = 2 + 7.25j # complex - Immutable Object | |
str_ = 'This is a text' # str - Immutable Object | |
bool_ = False # bool - Immutable Object | |
type(int_) # int - Integer Numbers | |
# <class 'int'> | |
type(float_) # float - Floating Point Numbers | |
# <class 'float'> | |
type(complex_) # complex - Complex Numbers | |
# <class 'complex'> | |
type(str_) # str - String Literals | |
# <class 'str'> | |
type(bool_) # bool - Boolean Values | |
# <class 'bool'> | |
# Non-Primitive Data Structures (Types) | |
# Collection of Data Types (type) | |
# Where type = int, float, complex, str, list, dict, frozenset, tuple | |
type([type, ]) # list - Mutable Object | |
# <class 'list'> | |
type({type, }) # set - Mutable Object | |
# <class 'set'> | |
type({type: type, }) # dict - Mutable Object | |
# <class 'dict'> | |
type(frozenset({type, })) # frozenset - Immutable Object | |
# <class 'frozenset'> | |
type((type, )) # tuple - Immutable Object | |
# <class 'typle'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment