In [1]:
import math
class Pizza:
def __init__(self, radius,ingredients):
self.ingredients = ingredients
self.radius=radius
def __repr__(self):
return f'Pizza({self.ingredients})'
def area(self):
return self._circle_area(self.radius)
@staticmethod
def _circle_area(r):
return r**2 * math.pi
Pizza(4.5,'Cheese').area()
Out[1]:
In [0]:
from google.colab import drive
drive.mount('/content/drive')
In [2]:
Pizza._circle_area(12)
Out[2]: