Day-2 - Python Data Types – A Beginner’s Guide


When we start learning Python, one of the most important concepts to understand is data types.
Data types tell Python what kind of value a variable is storing — whether it’s text, a number, or a logical value.
The 4 Primitive Data Types in Python
Python provides four commonly used (primitive) data types:
1. String (str
)
Represents a sequence of characters (text).
Example:
name = "Ravi"
message = "Hello, Python!"
2. Integer (int
)
Represents whole numbers, both positive and negative.
Example:
age = 30
year = -2025
3. Float (float
)
Represents numbers with decimal points.
Example:
pi = 3.14
temperature = -5.8
4. Boolean (bool
)
Represents logical values, either
True
orFalse
.Example:
is_active = True
is_admin = False
Dynamic Typing in Python
Unlike many other programming languages, Python does not require you to explicitly declare the type of a variable.
Instead, Python uses dynamic typing, which means it automatically detects the type based on the value you assign.
✅ Example:
username = "Alice" # String
score = 95 # Integer
height = 5.9 # Float
is_verified = True # Boolean
Here, Python figures out the data type for each variable on its own.
Final Thoughts
Python’s dynamic typing makes it beginner-friendly and flexible. You don’t need to worry about declaring data types — just assign a value, and Python will handle the rest. 🚀
Subscribe to my newsletter
Read articles from Raviteja Vaddamani directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
