Which is what we would expect. Python is telling us that
get_length is a function. What we want to print is the value that function returns. This means we can print directly a call expression, or print a saved call expression. The key here is the return value of the function.
diego = get_length("Diego")
In each case the
print() function is being given a value rather than a reference to some object that cannot be literally represented.
Values such as numbers, strings, lists, dictionaries, booleans and None can be represented in a literal sense in the standard output. Functions and class objects are a little more involved. We saw the output when we tried to print a function reference…