var1 = 'ketchup'
regularprice = 12.80
discount_percentage = 0.27
finalprice = regularprice*(1-discount_percentage)
print('${:.2f} is the sale price of ketchup.'. format(finalprice))
print('${:.2f}is the sale price of' + ' ' + var1 + '.'. format(finalprice))
As shown above, I found that the second 'print' which added a variable could not display correctly. The format function didn't work.
Could anybody give me some hints? : )