0

I'm having trouble trying to convert the results of my "def pricing(question)" function into decimal values instead of scientific.

I tried converting the result to a string but that didn't work and I can't see anyway of formatting the pricex variables where they are.

Any help is much appreciated

Code

enter image description here Result

enter image description here

Sayali Sonawane
  • 12,289
  • 5
  • 46
  • 47
  • You should post your code in the question. You can format it by highlighting it and pressing CTRL+k – Farhan.K Sep 23 '16 at 14:36
  • This question has already been answered on SO: [Convert Scientific Notation to Decimal - Python](http://stackoverflow.com/questions/16962512/convert-scientific-notation-to-decimal-python) – soohoonigan Sep 23 '16 at 14:37

1 Answers1

1

You need to use a formatting string.

>>> import math
>>> print(math.pi)
3.141592653589793
>>> print("{:.2f}".format(math.pi))
3.14
asthasr
  • 9,125
  • 1
  • 29
  • 43