def reverse(x):
a = x if x >= 0 else -x
li = []
while a:
b = a % 10
li.append(b)
a = int(a / 10)
c = 0
for i in li:
c = c*10 + i
c = c if x >= 0 else -c
return c if c < 2147483647 and c > -2147483648 else 0
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
x = int(str(x)[::-1]) if x>=0 else -int(str(-x)[::-1])
return x if x < 2147483647 and x > -2147483648 else 0