def float_format(number):
 return ('%.3f' % number).rstrip('0').rstrip('.')

def float_format ( number ) : return ( '%.3f' % number ) . rstrip ( '0' ) . rstrip ( '.' )
format a float to a precision of 3 .