In this example we will show how to format the number to be displayed as a number with four decimals in Python.
Source Code
import math
print('PI:', math.pi)
print('PI: {:.4f}'.format(math.pi))
Output:
PI: 3.141592653589793
PI: 3.1416
In this example we will show how to format the number to be displayed as a number with four decimals in Python.
import math
print('PI:', math.pi)
print('PI: {:.4f}'.format(math.pi))
Output:
PI: 3.141592653589793
PI: 3.1416