Module 4 of 15 · Step 1 of 10

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
Concept 1 of 4

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 = True
Code
course = "Python"
lessons = 15
is_active = True
print(course)
Output
Python

Why it works

  1. course stores text (str).
  2. lessons stores a whole number (int).
  3. is_active stores a Boolean (bool), written with a capital T.

Common mistake

Not this
ready = true
Try this
ready = True

Python's Boolean words begin with capital letters.