@@ -0,0 +1,1224 @@
+# Given two integers representing the numerator and denominator of a fraction, %0A# return the fraction in string format.%0A# If the fractional part is repeating, enclose the repeating part in parentheses.%0A%0Aclass Solution:%0A    # @return a string%0A    def fractionToDecimal(self, numerator, denominator):%0A        (integer, remainder) = divmod(numerator, denominator)%0A        if remainder == 0:%0A            return str(integer)%0A        else:%0A            return str(integer) + '.' + self.tenths(remainder, denominator, '')%0A            %0A    def tenths(self, numerator, denominator, history):%0A        if denominator == 10:%0A            return history + str(numerator)%0A        else:%0A            (integer, remainder) = divmod((10 * numerator), denominator)%0A            if remainder == 0:%0A                return history + str(integer)%0A            elif (remainder, denominator) == (numerator, denominator):%0A                return history + '(' + str(integer) + ')'%0A            elif str(integer) in history:%0A                repeating = history.index(str(integer))%0A                return history%5B:repeating%5D + '(' + history%5Brepeating:%5D + ')'%0A            else:%0A                return self.tenths(remainder, denominator, history + str(integer))

unfinished fraction to decimal initial