Skip to main content

Python Data Types Explained for Beginners

Updated 3 min readMarkdown
Python Data Types Explained for Beginners

Python Data Types Explained for Beginners Every Python program runs on data. Before writing your first real script, you need to understand the building blocks — data types.

What Are Data Types? In Python, a data type tells the interpreter what kind of value a variable holds and what operations can be performed on it. Python is dynamically typed, meaning you don't need to declare types explicitly — Python figures it out automatically. Let's walk through the most important ones.

  1. Integer (int) Whole numbers — positive, negative, or zero — with no decimal point. pythonage = 21 year = 2026

print(age) # 21 print(year) # 2026

Use int for counts, ages, years, IDs, or anything without a fractional part.

  1. Float (float) Numbers with a decimal point. Used for precision values like prices, temperatures, or percentages. pythonprice = 99.99 temperature = 36.5

print(price) # 99.99 print(temperature) # 36.5

  1. String (str) A sequence of characters enclosed in single or double quotes. Strings store any kind of text. pythonname = "Yash" course = "Data Science"

print(name) # Yash print(course) # Data Science

Strings support a rich set of methods like .upper(), .split(), .replace(), and more.

  1. Boolean (bool) Booleans have only two possible values: True or False. They're the foundation of all conditional logic in Python. pythonis_student = True is_logged_in = False

print(is_student) # True print(is_logged_in) # False

  1. List An ordered, mutable collection. Lists can hold mixed types and are one of Python's most versatile structures. pythonskills = ["Python", "SQL", "Power BI"]

print(skills) # ['Python', 'SQL', 'Power BI']

Mutable means you can add, remove, or change items after creation.

  1. Tuple Like a list, but immutable — once created, its contents cannot change. Useful for fixed collections like coordinates or configuration values. pythoncolors = ("Red", "Blue", "Green")

print(colors) # ('Red', 'Blue', 'Green')

Tuples are faster than lists and signal intent: this data should not change.

  1. Dictionary (dict) A collection of key-value pairs — perfect for structured data where each piece has a label. pythonstudent = { "name": "Yash", "age": 21, "course": "Data Science" }

print(student)

{'name': 'Yash', 'age': 21, 'course': 'Data Science'}

Think of a dictionary like a real dictionary — look up a key, get back its value.

Checking Data Types with type() Not sure what type a variable is? Python's built-in type() function tells you instantly. pythonx = 10 print(type(x)) # <class 'int'>

y = "hello" print(type(y)) # <class 'str'> This is especially useful while debugging or exploring unfamiliar data.

Quick Reference Data TypeExampleUse Caseintage = 21Whole numbersfloatprice = 99.99Decimal numbersstrname = "Yash"Textboolis_student = TrueTrue/False logiclist["Python", "SQL"]Ordered, changeable collectiontuple("Red", "Blue")Ordered, fixed collectiondict{"name": "Yash"}Key-value pairs

Conclusion Data types are the foundation everything in Python is built on. Once you understand how integers, floats, strings, booleans, lists, tuples, and dictionaries work — and when to use each — writing clean, efficient code becomes much more natural. Whether you're heading into Data Science, Machine Learning, or backend development, you'll use these every single day.

If this helped you, drop a ❤️ and follow for more beginner-friendly Python content.

About the author

  • Data Analyst | Machine Learning Engineer | Creating real-world projects with Python, SQL, Power BI, and FastAPI.

No comments yet. Be the first to comment.