The .format() method of the str type is an extremely convenient way to format text exactly the way you want it.
Here is the general form:
template.format(p0, p1, ..., k0=v0, k1=v1, ...)
The arguments to the .format() method are of two types. The list starts with zero or more positional arguments pi, followed by zero or more keyword arguments of the form ki=vi, where each ki is a name with an associated value vi.
1.Here we could see that if there are are no values in the curly brackets it directly maps according to the position. And if there are are position given in the curly brackets then it maps them according to the given index.
2.If you want to shift a no to right then you can include the no of spaces required after the colon
3.For printing a no its square and its cube we can use the formatting techniques.
We could see the difference when we use the formatting tools. The 1st one uses formatting functions.
4.We can use it for rounding of some values to given decimal points.