How to get the PI value in Python

1 Answer

0 votes
import math

print("PI = %.2f" % math.pi)
print("PI = %.3f" % math.pi)

'''
run:

PI = 3.14
PI = 3.142

'''

 



answered Feb 19, 2016 by avibootz
edited Feb 19, 2016 by avibootz

Related questions

1 answer 184 views
184 views asked Nov 29, 2022 by avibootz
2 answers 353 views
1 answer 201 views
2 answers 483 views
2 answers 387 views
1 answer 248 views
248 views asked Jun 12, 2019 by avibootz
...