A variable is like a container or label that stores information in a computer’s memory. When you assign a value to a variable, you’re giving a name to some data.
💡 Real-life Analogy:
Think of a variable like a jar with a label. You can write anything inside the jar (data), and the label (variable name) tells you what it is.
name = "Alice"
age = 25
is_student = TrueIn the above example:
namestores a stringagestores an integeris_studentstores a Boolean value
📌 Key Python Data Types:
Data Type | Description | Example |
|---|---|---|
| Whole numbers |
|
| Decimal numbers |
|
| Text |
|
| True or False |
|
| Ordered collection |
|
| Immutable list |
|
| Key-value pairs |
|
| Unordered unique items |
|
✅ Tip: Python is dynamically typed, so you don't need to mention the type explicitly.