how to take float upto two decimal places in python code example
Example 1: printing with format float to 2 decimal places python
formatted_float = "{:.2f}".format(a_float)
Example 2: force two decimal places python
print ("{0:.2f}".format(a))
formatted_float = "{:.2f}".format(a_float)
print ("{0:.2f}".format(a))