In chapter 2, print(template) is not giving expected answer as the original string never get changed by this format
AnCyNitinChaudhary opened this issue · comments
Nitin Chaudhary commented
Your Code:
template="{0:.2f} {1:s}are worth US${2:d}"
template.format(4.5667,'Argentine Pesos',1)
print(template)
Output Your Code:
{0:.2f} {1:s}are worth US${2:d}
Updated Code:
template="{0:.2f} {1:s}are worth US${2:d}".format(4.5667,'Argentine Pesos',1)
print(template)
Output Updated Code:
4.57 Argentine Pesosare worth US$1
Wes McKinney commented
This is fixed in the 3rd edition, you can see the new code here: