2.2 What Is Pi?
In this chapter, we continue to explore computer science, problem solving, and the Python programming language by considering one of the most famous numbers of all: the number pi, often represented by the Greek letter π. Almost everyone has at one time or another used the value pi. In fact, we used π in the Introduction to Python chapter in our circle calculations.
Pi is defined to be the ratio of a circle’s circumference to its diameter (FIGURE 2.1). This relationship, π = C/d, gives rise to the familiar equation C = πd that is used to compute the circumference of a circle given the diameter. Because the diameter of a circle is twice the radius, this relation can also be written as C = 2πr, where r is the radius.
FIGURE ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access