Curriculum / Python / Lesson 03

Data Types in Python

Python's core built-in types include int (whole numbers), float (decimals), str (text), and bool (True/False).

3 of 11
beginner 📖 5 min read 🎯 1 question

Data Types

Python's core built-in types include int (whole numbers), float (decimals), str (text), and bool (True/False). Python also has built-in collection types like list, tuple, and dict, covered in more depth in later topics.

💡 Key insight Python's int type has no fixed size limit — it can grow to represent arbitrarily large numbers automatically.

Syntax

syntax
int, float, str, bool, list, tuple, dict

Example

Each variable's type is inferred automatically from the value assigned to it.

py
age = 20            # int
gpa = 8.9           # float
name = "CodeyHub"   # str
passed = True        # bool

print(type(age), type(gpa), type(name), type(passed))
output<class 'int'> <class 'float'> <class 'str'> <class 'bool'>

Try it yourself

Copy this example into the Python compiler and run it — try changing a value and see what happens.

Quick Quiz

1. How is the boolean value for 'true' written in Python?

Back to curriculum