In print("%.2f" % total) , waht does "%.2f" % total mean?


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

Replace this line with your code.

<do not remove the three backticks above>

#2

%f is a placeholder for a float, just like %s is a placeholder for a string. (this one has been covered right?)

it allows us to insert variable into a string.

the .2 is special for the %f to indicate the number of decimals you want to display, in this case 2 decimals


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.