Data Types
int, float, str, bool, None
Interview Relevant: Fundamental knowledge
Data Types
Python is dynamically typed but strongly typed.
- Numeric: int, float, complex
- Sequence: str, list, tuple
- Mapping: dict
- Set: set, frozenset
- Boolean: bool (True/False)
- None: NoneType (null equivalent)
Code Examples
Checking types with type().
python
1type(10) # <class 'int'>
2type(3.14) # <class 'float'>
3type("Hi") # <class 'str'>
4type(True) # <class 'bool'>
5type(None) # <class 'NoneType'>