Skip to content

Instantly share code, notes, and snippets.

@CodeDrome
Created July 28, 2020 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeDrome/2c2e7f1afc1ce9123ccaf0e389f89ad0 to your computer and use it in GitHub Desktop.
Save CodeDrome/2c2e7f1afc1ce9123ccaf0e389f89ad0 to your computer and use it in GitHub Desktop.
estimatingpi.py part 2
def fractions():
"""
Estimates pi using a selection of increasingly accurate fractions
"""
pi = 22 / 7
print("22/7\n====")
print_as_text(pi)
pi = 333 / 106
print("333/106\n=======")
print_as_text(pi)
pi = 355 / 113
print("355/113\n=======")
print_as_text(pi)
pi = 52163 / 16604
print("52163/16604\n===========")
print_as_text(pi)
pi = 103993 / 33102
print("103993/33102\n============")
print_as_text(pi)
pi = 245850922 / 78256779
print("245850922/78256779\n==================")
print_as_text(pi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment