In the multiple choice question I'm stucked in, there are three options. Here goes the question:
Which of the following is a definition of the _str_method?
1. def __str__(self):
print "(%s, %s, %s)" % (self._n, self._p, self._b)
2. def __str__(self):
return "(%s, %s, %s)" % (self._n, self._p, self._b)
3. Both
I tested both of them, and both worked, but it is said that (2) is the answer.
The answers of all other similar questions also say that the function with 'print' is not the right one.
Is the answer wrong?
Thanks