More details on conversion specifiers can be found
here.
\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "owdb4-EPElxE"
},
"source": [
"In most cases, we just use %s, %f, %d, etc as the conversion specifiers."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "yfazLbxRC6UU"
},
"outputs": [],
"source": [
"'purchase %d shares of %s at $%f per share' % (shares, stock, price) # The default precision of 'f' is 6."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "w6p457VHExbF"
},
"source": [
"**More usages**\n",
"\n",
"When we want to control **the length (for string values) or precision of values**, use `%.