Skip to content

Note 03: Types

A value's type determines what operations make sense for it.

Type Example Typical Use
int 42 Whole-number counts
float 3.14 Measurements and fractional values
str "hello" Text
bool True Conditions and yes/no state

Conversion

input() always returns text, so numeric work often begins with conversion:

age_text = input("Age: ")
age = int(age_text)

Use conversion deliberately. If the user enters something unexpected, the program may fail unless later material adds validation.