Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- if __name__ == '__main__':
- pi = 0.0
- r = 1000
- r2 = r * r
- for x in range(0, r):
- h = x + 0.5
- x2 = h * h
- y = sqrt(r2 - x2)
- print(f'{x:2d}', f'{y:5.1f}')
- pi += y
- print(4 * pi / r2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement