human
Solve in Python:
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.

Example:
Given a = 1 and b = 2, return 3.

Credits:Special thanks to @fujiaozhu for adding this problem and creating all test cases.
assistant
#Here is Python code to calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.

class Solution:
     def getSum(self, a, b):
         """
         :type a: int
         :type b: int
         :rtype: int
         """
         if a == 0:
             return b
         if b == 0:
             return a
         
         MAX = 0x7FFFFFFF
         MIN = 0x80000000
         mask = 0xFFFFFFFF
         while b:
             a, b = (a ^ b) & mask, ((a & b) << 1) & mask
         
         return a if a <= MAX else ~(a ^ mask)