"Cai Gengyang" wrote in message
news:d34dc21b-fe74-40fc-9b54-c37110529...@googlegroups.com...
meal = 44.50
tax = 0.0675
tip = 0.15
meal = meal + meal * tax
total = meal + meal * tip
print("%.2f" % total)
What do the lines inside the parentheses in this statement p
On Sun, Nov 22, 2015 at 5:30 PM, Cai Gengyang wrote:
> What do the lines inside the parentheses in this statement print("%.2f" %
> total) mean ?
>
> What does "%.2f" % total represent ?
>
This is called "percent formatting" or "printf-style
print the two digits after the point.
On 11/21, Cai Gengyang wrote:
>
> meal = 44.50
> tax = 0.0675
> tip = 0.15
>
> meal = meal + meal * tax
> total = meal + meal * tip
>
> print("%.2f" % total)
>
> What do the lines inside the parentheses in t
meal = 44.50
tax = 0.0675
tip = 0.15
meal = meal + meal * tax
total = meal + meal * tip
print("%.2f" % total)
What do the lines inside the parentheses in this statement print("%.2f" %
total) mean ?
What does "%.2f" % total represent ?
Thank