- int
- str
- float
- bool
Literals, Value Types in Python
examples/basics/show_types.py
print( type(23) ) # int print( type(3.14) ) # float print( type("hello") ) # str print( type("23") ) # str print( type("3.24") ) # str print( type(None) ) # NoneType print( type(True) ) # bool print( type(False) ) # bool print( type([]) ) # list print( type({}) ) # dict print( type(hello) ) # NameError: name 'hello' is not defined print("Still running")
Traceback (most recent call last): File "python/examples/basics/types.py", line 15, in <module> print( type(hello) ) # str NameError: name 'hello' is not defined
- Strings must be enclosed in quotes.
- Numbers must be NOT enclosed in quotes.