Data Types
View Notebook
Every value has a type, and the built-in type function returns the type of the result of any expression.
type(3)
type(3/1)
The type of an expression is the type of its final value. So, the type function will never indicate that the type of an expression is a name, because names are always evaluated to their assigned values.
x = 3
type(x) # The type of x is an int, not a name
Another type we have encountered already is a built-in function. Python indicates that the type is a builtin_function_or_method; the distinction between a function and a method is not important at this stage.
type(abs)
This chapter will explore other useful types of data.