#NEWLINE# def frac( self , num , deno ) : #NEWLINE# #INDENT# '\n        real fraction part\n        ' #NEWLINE# ret = [ ] #NEWLINE# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# i = 0 #NEWLINE# while num : #NEWLINE# #INDENT# num *= 10 #NEWLINE# q = ( num / deno ) #NEWLINE# r = ( num % deno ) #NEWLINE# if ( ( q , r ) in d ) : #NEWLINE# #INDENT# ret . append ( ')' ) #NEWLINE# ret . insert ( d [ ( q , r ) ] , '(' ) #NEWLINE# return '' . join ( ret ) #NEWLINE# #UNINDENT# ret . append ( str ( q ) ) #NEWLINE# d [ ( q , r ) ] = i #NEWLINE# i += 1 #NEWLINE# num -= ( q * deno ) #NEWLINE# #UNINDENT# return '' . join ( ret )