Python for Data Analytics • Lesson 3
Python Data Types
Learn how Python classifies values as integers, floats, strings and booleans, and how to identify a value's data type using type().
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
What Is a Data Type?
A data type tells Python what kind of value it is working with. Different kinds of values behave differently: numbers add, text joins, booleans answer True or False.
Learn by Seeing
Four kinds of value
25 # int 25.5 # float "25" # str True # bool
Python classifies every value into a type, and that type decides what operations are valid.
Click any value — see its type:
type
int
Whole number, no decimal point.
Interactive Activity
What does a data type tell Python?
Hint: It is about the kind of value, not the variable name.
Python Analyst Mindset
Type is the first thing to check
Almost every beginner Python error is a type error in disguise. When something behaves strangely, the first thing an analyst does is inspect the type with type() — it tells you immediately whether you're working with text or a number.
Classify
Decide if the value is a number, text or bool.
Inspect
Use type() to confirm.
Match
Ensure operands have compatible types.
Convert
Use int(), float(), str() when needed.
Frequently Asked Questions
Data Types — FAQs
No. "100" is a string (with quotes); 100 is an int (without quotes). Python treats them completely differently.
It returns a type object, like <class 'int'>. Wrapping it in print() just displays that object as text.
Yes. Python is dynamically typed: score = 50 then score = "good" is legal, though confusing.
The + operator needs both operands to be the same type. Mixing str and int raises a TypeError; convert one side first.
Lesson Summary
What you learned
Whole numbers, positive or negative.
Numbers with a decimal point.
Text in single or double quotes.
True or False.
Inspect any value's type.
Mixing str and int raises a TypeError.