How can I print 1000 value of pi using the following code? Can I use range() function to this below method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I print 1000 value of pi using the following code? Can I use range() function to this below method?

Code: from math import pi print(pi)

13th Dec 2017, 6:59 PM
Bits!
3 Answers
0
from math import pi from decimal import Decimal print(Decimal(pi)) this output the exact value of pi stored in python, if not mistaken. I believe you will get zeros for any floating point beyond this.
15th Dec 2017, 5:45 AM
Hanz
Hanz - avatar
0
check out this tutorial: https://docs.python.org/2/tutorial/floatingpoint.html
15th Dec 2017, 5:46 AM
Hanz
Hanz - avatar
- 1
just search for it online
14th Dec 2017, 7:33 PM
Meta Byte
Meta Byte - avatar