the template in this example may be more readable than the previous examplesbut the overhead of creating an -mail class adds complexity to the python code it would be foolish to create class for the express purpose of including the object in template typicallywe' use this sort of lookup if the object we are trying to format already exists this is true of all the examplesif we have tuplelistor dictionarywe'll pass it into the template directly otherwisewe' just create simple set of positional and keyword arguments making it look right it' nice to be able to include variables in template stringsbut sometimes the variables need bit of coercion to make them look right in the output for exampleif we are doing calculations with currencywe may end up with long decimal that we don' want to show up in our templatesubtotal tax subtotal total subtotal tax print("sub${ tax${ total${total}formatsubtotaltaxtotal=total)if we run this formatting codethe output doesn' quite look like proper currencysub$ tax$ total$ technicallywe should never use floating-point numbers in currency calculations like thiswe should construct decimal decimal(objects instead floats are dangerous because their calculations are inherently inaccurate beyond specific level of precision but we're looking at stringsnot floatsand currency is great example for formattingto fix the preceding format stringwe can include some additional information inside the curly braces to adjust the formatting of the parameters there are tons of things we can customizebut the basic syntax inside the braces is the samefirstwe use whichever of the earlier layouts (positionalkeywordindexattribute accessis suitable to specify the variable that we want to place in the template string we follow this with colonand then the specific syntax for the formatting here' an improved versionprint("sub${ : ftax${ : "total${total: }formatsubtotaltaxtotal=total)