EEMI

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