CodeX
Published in

CodeX

Approximating Pi (π) using Python & Some Math

Some Apple Lattice Pie

We’ve all probably learnt about pi (π) in school at some point in our lives, and know it as the irrational mathematical constant 3.14159......, which is defined as the ratio of a circle’s circumference to its diameter. While we can simply get pi using Python’s math module:

import math
pi = math.pi # and we get 3.14159......

--

--

--

Everything connected with Tech & Code. Follow to join our 900K+ monthly readers

Recommended from Medium

Difference between Deterministic and Non-deterministic Algorithms

Computational Materials Science

Monte Carlo Integration

Delineating Ashtakvarga for predicting precisely timing of events in Astro Chart

Monte Carlo for Matrix Models

Writing A Good Hypothesis Worksheet High School

How To Calculate Sports Odds

How to calculate moneyline odds

My rejected scholarship essay

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zlliu

Zlliu

Full-time Software Engineer. Part-time Python Tutor, Tech Writer & Crypto Investor. Free-time pianist, gamer, gardener & self-proclaimed cook

More from Medium

Binary Search Trees Explained Simply with Python

I Shortened This 21-Line Function Into One Line For Fun

Learn String/List Slicing (Python) in 3 Minutes

How to Create a Basic Form in Python Flask