
142 Introduction to Computational Models with Python
9.6 COMPLETE PROGRAM WITH A CLASS
Listing 9.1 shows a Python pr ogram stored in file circlep.py that includes
the class definition Circle. The statements following the class definition create
and manipulate objects of class Circle.
Listing 9.1 Python program with definition of class Circle.
2 # Program : circlep.py
3 # Author : Jose M Garrido, May 21 2014.
4 # Description : This program defines a class for circles
5 # Computes the area and circumference of circles
7 # Reads the value of the radius for several circles
8 # from the input console, display results.
9
10 import math
11
12 class Circle:
13 ’Circle ...