When calling a function, if the number of parameters of the function is incorrect, a TypeError will be reported, such as
TypeError: abs() takes exactly one argument (2 given)
The abs function has only one parameter, but two were given
If the parameter type cannot be accepted by the function, an error will also be reported, such as
TypeError: bad operand type for abs(): 'str'
str is the wrong parameter type
data type conversion
Commonly used functions in Python also include data type conversion
>>> int('123') 123 >>> float(123) 123.0 >>> str(321) '321' >>> bool(1) True
A function name is actually a reference to a function object. You can assign the function name to a variable, which is equivalent to giving the function an alias.
>>> a = print >>> a('boom') boom