Sum of Two Integers without using '+' operator in python 2 or 3
<pre><code>class Solution(object):
    def getSum(self, a, b):
        if (a == 0):
            return b
        if (b == 0):
            return a;
        while(b != 0):
            _a = a ^ b
            _b = (a &amp; b) &lt;&lt; 1
            a = _a
            b = _b
        return a
</code></pre>

<p>But when one of a, b &lt; 0 or both, how the script should be like?</p>

<p>I enjoy solving other people's problems.</p>

<pre><code>class Solution(object):
    def getSum(self, a, b):
        return sum([a, b])
</code></pre>

<p><strong>Edit:</strong> If you are in for some fantasy. You can do operator overloading.</p>

<pre><code>class CrappyInt(int):

    def __init__(self, num):
      self.num = num

    def __eq__(self, a):
      return self.__add__(a)


m = CrappyInt(3)
n = CrappyInt(4)

print m == n
# 7
</code></pre>

<p>This maybe a little hard for you now. But it is fun.</p>

python