Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Computes pi
- # ToDo: draw a bigger circle for more precision
- s = (' __ \n'
- ' - - \n'
- ' - - \n'
- '| -\n'
- ' - - \n'
- ' - - \n'
- ' -- \n')
- c = 0.0
- r = 0.0
- for _ in s:
- if _ == '-':
- c += 1.0
- if _ == '\n':
- r += 1.0
- # Each Symbol accounts for 2 units in circumference
- c *= 2
- # Radius, not diameter
- r /= 2
- print(c/2/r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement