Re: print("%.2f" % total)

2015-11-21 Thread Frank Millman
"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

Re: print("%.2f" % total)

2015-11-21 Thread Chris Angelico
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

Re: print("%.2f" % total)

2015-11-21 Thread Stephane Wirtel
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

print("%.2f" % total)

2015-11-21 Thread Cai Gengyang
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