It seems like they skip the “print (type(variable_name))” I don’t recall learning different types of print. What does the “type” actually do when run print function? I’m lost. Thanks in advance for your help.
There is only one print() function, which always does the same thing: it first evaluates the expression within its parentheses, and then sends a string representation of the returned value to the default i/o device (usually your screen).
In this case, the expression is type(), which is is itself a function: It returns the type (i.e., int, str, float, etc.) of the argument passed when it is called.
print(type(3.14)) print(type('abc')) my_boolean = (5 > 2) print(my_boolean) print(type(my_boolean))
<class 'float'> <class 'str'> True <class 'bool'>
type is a type, the type of types :^)
>>> type(type) <class 'type'>