For each of the following functions/operators and the given
types of inputs, what will be the type of the returned
value? If you think this will always cause an error, just write
"error". If you think this will sometimes cause an error,
explain when it will cause an error.
Note: the examples to be analyzed for
Task G contain both functions and value types
that are passed to those functions.
e.g. if a line contains:
aaa(bbb)
by looking at its Python syntax, we know that aaa is the name of a
function, because it is followed by an '(' i.e. open parenthesis.
We can also assume that bbb has a value of a certan type, because
it is notfollowed by an '(' open parentheses.
And if another line contains:
ccc ^ ddd
then we know that ccc and ddd are values that are used as input
values for the '^' operator (the '^' operator performs a function
that we haven't seen yet, but we're using it here just as an
example).
You have to be careful, since some of these names may denote both a
function as well as a value type. For example, as explained in the
official Python documentation, float() and float are quite
different from each other!
The answer of the question is provided below, please comment if any doubts:
B.
0.int(int) => int
Get Answers For Free
Most questions answered within 1 hours.