Data Types
Variables can store data of different types - so far we have discussed numbers (integers and floats), strings, lists, and bools. You can determine the type of a variable using type()
:
type(45)
Output:
int
Here’s the string type:
type("Hello")
Output:
str
The list type:
type([2, 5, 7, 10])
Output:
list
The boolean type:
type(True)
Output:
bool
Exercises
What is type('45')
and why is this different from the first example above?