<human>:  Python Decimals format
<bot>: Here is some code to format a string `num` using string formatting

"""{0:.3g}""".format(num)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.