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:
intHere’s the string type:
type("Hello")Output:
strThe list type:
type([2, 5, 7, 10])Output:
listThe boolean type:
type(True)Output:
boolExercises
What is type('45') and why is this different from the first example above?