Python Data Types and Assignment Operators
Python Data Types
Python provides various data types to store and manipulate different kinds of data efficiently.
1. Numeric Types:
int (Integer) – Whole numbers (e.g., 10, -5)
float (Floating Point) – Decimal numbers (e.g., 3.14, -2.5)
complex – Complex numbers (e.g., 2 + 3j)
2. Sequence Types:
str (String) – Text data enclosed in quotes (e.g., "Hello")
list – Ordered, mutable collection (e.g., [1, 2, 3])
tuple – Ordered, immutable collection (e.g., (1, 2, 3))
range – Sequence of numbers (e.g., range(5) → 0,1,2,3,4)
3. Set Types:
set – Unordered, unique elements (e.g., {1, 2, 3})
frozenset – Immutable version of a set
4. Mapping Type:
dict (Dictionary) – Key-value pairs (e.g., {"name": "Alice", "age": 25})
5. Boolean Type:
bool – Represents True or False
6. Binary Types:
bytes, bytearray, memoryview – Used for handling binary data
7. None Type:
NoneType – Represents a null value (None)
---
Python Assignment Operators
Assignment operators are used to assign values to variables.
Understanding data types and assignment operators is fundamental for writing efficient Python programs!
#python #pythoncourseforbeginners #pythondatatypes #int #string #float