def frac(self, num, deno):
        ret = []
        d = {}
        i = 0

        while num:
            num *= 10
            q = num/deno
            r = num%deno
            if (q, r) in d:
                ret.append(")")
                ret.insert(d[(q, r)], "(")
                return "".join(ret)

            ret.append(str(q))
            d[(q, r)] = i
            i += 1
            num -= q*deno

        return "".join(ret)
real fraction part
dataset/ETHPy150Open algorhythms/LeetCode/166 Fraction to Recurring Decimal.py/Solution.frac