Data Types
A type tells Python what kind of value it has. A whole number, decimal, piece of text, and true-or-false choice behave differently.
By the end of this lesson, you can:
- Recognize int, float, str, and bool
- Inspect a value with type()
- Convert simple numeric text
- Choose a suitable type
Data Types lesson progress0%
Course progress: 0% · 0 of 10 steps completed in this module
Learn · Four everyday value types
Four everyday value types
int is a whole number, float is a decimal, str is text in quotes, and bool is True or False. Python remembers the type of each value, even when two values look similar on screen.
Pattern
count = 3
price = 2.5
name = "Ada"
ready = TrueCode
course = "Python"
lessons = 15
is_active = True
print(course)Output
Python
Why it works
- course stores text (str).
- lessons stores a whole number (int).
- is_active stores a Boolean (bool), written with a capital T.
Common mistake
Not this
ready = trueTry this
ready = TruePython's Boolean words begin with capital letters.