What is the print line doing?


It says

print("%.2f" % total)

What is this doing?


The expression is a string formatting template.

In the string,

"  __everything__in_quotes__
% formatting operator
.2 modifier
f value data type

Outside of the string

% operator
total variable/value

The data being printed is a float, represented by total. The modifier indicates two (2) decimal places, such as currency. The value is not altered, only copied and converted to a string.


total =  15.695
print("%.2f" % total)    # 15.70