As your radius is a default argument,then so can
It can also be be a class attribute with
pie
be.It can also be be a class attribute with
self.pie
as @buran suggests.class Circle: def __init__(self, radius=1, pie=3.14): self.radius = radius self.pie = pie self.area = self.pie * self.radius * self.radius def circum(self): return(2 * self.pie * self.radUse:
>>> mycircle = Circle() >>> mycircle.circum() 6.28 >>> # Can change radius,pie is the same as it always has been >>> mycircle = Circle(2) >>> mycircle.circum() 12.56Also look at PEP-8,for small changes that i made.