Guided Notes

Data Types & Variables

Integers, floats, strings, booleans, type(), and converting between them.

Every value has a type

Slide 1 / 5

Informally we say "number" or "text", but Python has precise names for each kind of value — and the type decides what you can do with it.

Ask for any value's type with the built-in type() function:

type(0) → int type(19.95) → float type("Spam") → str type(True) → bool

TypeWhat it holdsExamples
intWhole numbers0, 42, -7
floatNumbers with a decimal point19.95, 0.5, -3.0
strText"Spam", 'Ada'
boolTrue or FalseTrue, False
← Introduction to Python