Advertisement
rjcostales

Untitled

Jan 14th, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | Software | 0 0
  1. from math import sqrt
  2.  
  3. if __name__ == '__main__':
  4.  
  5.    pi = 0.0
  6.    r = 1000
  7.    r2 = r * r
  8.    for x in range(0, r):
  9.       h = x + 0.5
  10.       x2 = h * h
  11.       y = sqrt(r2 - x2)
  12.       print(f'{x:2d}', f'{y:5.1f}')
  13.       pi += y
  14.  
  15.    print(4 * pi / r2)
  16.  
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement