format number in python

num = 123
print(f'{num:.3f}') # 123.000

Here is what the above code is Doing:
1. f'{num:.3f}’ is a f-string. The f stands for format.
2. The {num:.3f} is called a format specifier.
3. The num is the variable whose value is to be formatted.
4. The :.3f is called a format specifier. It means the value should be formatted to 3 decimal places.
5. The .3f is called a precision specifier.
6. The f is called a type specifier.