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 ...

Get Python Programming in Context, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.