+ left, right, swap = 0, 0, False
+ for i, (symbol, coefficient) in enumerate(equality.coefficients()):
+ if coefficient > 0:
+ left += coefficient * symbol
+ else:
+ right -= coefficient * symbol
+ if i == 0:
+ swap = True
+ if equality.constant > 0:
+ left += equality.constant
+ else:
+ right -= equality.constant
+ if swap:
+ left, right = right, left
+ strings.append('{} == {}'.format(left, right))