Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Repeating Decimals by gyahun_dash
def convert(numer, denom):
intquo, rem = divmod(numer, denom)
decquo = ''
remlog = [rem]
while rem > 0:
quo, rem = divmod(rem * 10, denom)
decquo += str(quo)
if rem in remlog:
start = remlog.index(rem)
return '{}.{}({})'.format(intquo, decquo[:start], decquo[start:])
remlog.append(rem)
return '{}.{}'.format(intquo, decquo)
June 10, 2014
Comments: