Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Codecademy export
class Circle:
pi = 3.14
def __init__(self, diameter):
self.radius = diameter / 2
def area(self):
return self.pi * self.radius ** 2
def circumference(self):
return self.pi * 2 * self.radius
def __repr__(self):
return "Circle with radius {radius}".format(radius=self.radius)
medium_pizza = Circle(12)
teaching_table = Circle(36)
round_room = Circle(11460)
print(medium_pizza)
print(teaching_table)
print(round_room)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.