Using Python 2.7 how do I round my numbers to two decimal places rather than the 10 or so it gives?
print \"financial return of outcome 1 =\",\"$\"+str(out1)
A rather simple workaround is to convert the float into string first, the select the substring of the first four numbers, finally convert the substring back to float. For example:
>>> out1 = 1.2345 >>> out1 = float(str(out1)[0:4]) >>> out1
May not be super efficient but simple and works :)