well, they have a different value because:
In Solution1
, self.ans
is shared and persistent across method calls.
In Solution2
, unless special handling is used, the modification of ans
inside some_other_function
does not affect the outer ans
.