Blog
Different data types in Python
- July 29, 2024
- Posted by: Riddhi Dhandha
- Category: Java course at TCCI Programming Language Course Python Coaching at TCCI Python Training Institute in Ahmedabad
Here are some of the most commonly used data types in Python:
- **Numeric Types**:
– **int**: Integer values, e.g., `5`, `-3`
– **float**: Floating-point numbers, e.g., `3.14`, `-0.001`
– **complex**: Complex numbers, e.g., `1 + 2j`
- **Sequence Types**:
– **list**: Ordered, mutable collections of items, e.g., `[1, 2, 3]`
– **tuple**: Ordered, immutable collections of items, e.g., `(1, 2, 3)`
– **range**: Represents an immutable sequence of numbers, e.g., `range(0, 10)`
- **Text Type**:
– **str**: String literals, e.g., `”hello”`, `’world‘`
- **Binary Types**:
– **bytes**: Immutable sequences of bytes, e.g., `b’hello’`
– **bytearray**: Mutable sequences of bytes, e.g., `bytearray(5)`
– **memoryview**: Allows byte-level access to bytes-like objects without copying, e.g., `memoryview(b’abc’)`
- **Set Types**:
– **set**: Unordered collections of unique elements, e.g., `{1, 2, 3}`
– **frozenset**: Immutable version of a set, e.g., `frozenset([1, 2, 3])`
- **Mapping Type**:
– **dict**: Collections of key-value pairs, e.g., `{‘a’: 1, ‘b’: 2}`
- **Boolean Type**:
– **bool**: Represents truth values, `True` or `False`
- **None Type**:
– **NoneType**: Represents the absence of a value, `None`
These are the basic data types available in Python, each serving different purposes depending on the needs of the program.
TCCI Computer classes provide the best training in all computer courses online and offline through different learning methods/media located in Bopal Ahmedabad and ISCON Ambli Road in Ahmedabad.
For More Information:
Call us @ +91 98256 18292
Visit us @ http://tccicomputercoaching.com/