Skip to content

Commit bf429ca

Browse files
author
Amogh Singhal
authored
Update estimate_pi.py
1 parent 7f9aed8 commit bf429ca

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

estimate_pi.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,10 @@ def estimate_pi(sims=100):
2828
print("Estimated pi", pi_estimated)
2929
print("Error", PI - pi_estimated)
3030

31-
estimate_pi(sims=100)
32-
print()
33-
estimate_pi(sims=1000)
34-
print()
35-
estimate_pi(sims=10000)
36-
print()
37-
estimate_pi(sims=100000)
38-
print()
39-
estimate_pi(sims=1000000)
40-
print()
41-
estimate_pi(sims=10000000)
42-
print()
43-
estimate_pi(sims=100000000)
44-
print()
45-
estimate_pi(sims=1000000000)
31+
pow = 0
32+
input_sims = 100
33+
while pow <= 8:
34+
estimate_pi(sims=input_sims)
35+
pow += 1
36+
input_sims *= 10
37+

0 commit comments

Comments
 (0)