def fractionToDecimal(self, numerator, denominator):
        sign = 1 if numerator*denominator >= 0 else -1
        numerator = abs(numerator)
        denominator = abs(denominator)

        int_part = numerator/denominator
        frac_part = numerator-int_part*denominator

        if frac_part:
            decimal_part = self.frac(numerator-int_part*denominator, denominator)
            ret = str(int_part)+"."+decimal_part
        else:
            ret = str(int_part)

        if sign < 0:
            ret = "-" + ret

        return ret
The key is the remainder
dataset/ETHPy150Open algorhythms/LeetCode/166 Fraction to Recurring Decimal.py/Solution.fractionToDecimal