Variables & Data Types
- ✨ Python variables spring into existence when you assign them. and can change type at runtime. ✅
- 🔁 Python variables are created when you are first assigned a value — they reference objects and Python is dynamically typed, so a name can refer to different types over time. ♻️
- 🧭 Use clear, descriptive names (snake_case by convention), do not start identifiers with digits, and avoid reserved keywords. 🚫
- 🔍 Use type(value) to inspect a value’s type.
- You can assign multiple variables in one line (e.g., x, y = 1, 2). By convention, constants are written in ALL_CAPS. 📣
quantity = 12 # intunit_price = 50.00 # floatfruit = "Apple" # stringin_stock = True # boolScreenshot of Python code showing variable assignments and printing their types.

Complete Code :
quantity = 12 # intunit_price = 50.00 # floatfruit = "Apple" # stringin_stock = True # bool
print(type(quantity)) # <class 'int'>print(type(unit_price)) # <class 'float'>print(type(fruit)) # <class 'str'>print(type(in_stock)) # <class 'bool'>📌 Let’s compare it with other programming languages.
Variable Declaration in Other Languages
Section titled “Variable Declaration in Other Languages”In C# and JavaScript you must declare a type or use let/const:
C# Example:
int count = 1;string name = "Banky";JavaScript Example:
let count = 1;const name = "Banky";🔠 Naming Conventions Comparison
Section titled “🔠 Naming Conventions Comparison”👉 Click to expand: Comparison of common naming conventions
Using the example: “maximum retry count”
| Convention | Example | Typical Usage |
|---|---|---|
| snake_case | max_retry_count | Variables, functions (Python, Ruby) |
| camelCase | maxRetryCount | Variables, methods (JS, C#, Java) |
| PascalCase | MaxRetryCount | Classes, enums, types |
| ALL_CAPS | MAX_RETRY_COUNT | Constants, environment variables |
🔑 Key takeaway:
Naming conventions are not cosmetic — they communicate intent to other developers.