0% found this document useful (0 votes)
7 views2 pages

Python Data Types Notes

Python has several data types including numeric (int, float, complex), string, list, tuple, set, dictionary, boolean, binary data types, and None type. Each type serves specific purposes, such as storing whole numbers, sequences of characters, or key-value pairs. Understanding these data types is essential for efficient data storage and manipulation in Python.

Uploaded by

RAMU ramu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Python Data Types Notes

Python has several data types including numeric (int, float, complex), string, list, tuple, set, dictionary, boolean, binary data types, and None type. Each type serves specific purposes, such as storing whole numbers, sequences of characters, or key-value pairs. Understanding these data types is essential for efficient data storage and manipulation in Python.

Uploaded by

RAMU ramu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Different Data Types in Python

In Python, data types define the type of data a variable can store and the operations that can be
performed on it.

1. Numeric Data Types

1 int: Stores whole numbers (e.g., x = 100)


2 float: Stores decimal numbers (e.g., y = 10.5)
3 complex: Stores complex numbers (e.g., z = 3 + 4j)

2. String (str)

1 Sequence of characters enclosed in quotes


2 Immutable (cannot be changed after creation)
3 Example: name = 'Python'

3. List

1 Ordered collection of items


2 Mutable and allows duplicates
3 Example: numbers = [1, 2, 3]

4. Tuple

1 Ordered but immutable collection


2 Allows duplicates
3 Example: t = (1, 2, 3)

5. Set

1 Unordered collection of unique elements


2 No duplicates allowed
3 Example: s = {1, 2, 3}

6. Dictionary (dict)
1 Stores data in key-value pairs
2 Keys must be unique
3 Example: student = {'name': 'Ram', 'age': 20}

7. Boolean (bool)

1 Represents True or False values


2 Used in conditions
3 Example: x = True

8. Binary Data Types

1 bytes, bytearray, memoryview


2 Used for binary data storage
3 Example: b = b'hello'

9. None Type

1 Represents no value or null


2 Example: x = None

Conclusion: Python provides a variety of data types that help in efficient data storage and
manipulation.

You might also like