![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgUJQ8MrEOHz4bTj1Qtdl6ZL3xwJoXs6CwsLqd0hEI9zMOninKXyTTMrhFkIepxa7G0AqxrD2OeeA4fsIetNNbq2TKNQ10gizUl-8FCXLrqtCOvo3S2rDo3UaPsu5BXYsD9dsL/s400/python-logo-master-v3-tm-flattened.png)
for example we have the value 30.6475 which we would like to print to the screen as a dollar value like $30.65. What we could do is a rounding of the value 30.6475 and print it in combination with the dollar sign. It can also be done as shown below with a command like print "$%.02f" %30.6475
the 2f is used to define the amount of numbers behind the point. so we can make it for example 3 if we want a output like $30.648.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDzoaJP0XyAIHq8ibiss-ug87nubBOcn_OuA4LhMcaYNETcClpYimuWAyyxb4MKZpYa0cWtk_ljL0e-Lk-X5vXNgnJAFv__3EDELt4HH_1pjriXRamdiEsXLxx8sX_gmp88x28/s400/format_number_python.png)
1 comment:
this is my first visit to ur Blog , but u have impressed me since paython is not of expertise list ,..
Post a Comment