I'm making a simple program where it calculates your average salary per year by just asking a couple questions. So when it calculates it I want it so it has commas and gets rid of hanging zeros.
calculation = (hourly_rate * hours) * 52
format = "{:,}".format(calculation)
format_2 = "{:2f}".format(float(calculation))
#Formatting big numbers to include commas
print("{0}, your average salary for the {1} job, is ${2} per year."
.format(name, occupation, format_2))
The math is 13.65 * 32 * 52 = 22,713.6 But my output is: $22713.600000
What I want: $22,713.06