Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 14, 2020 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/108828bf9cb1969d3856e2444727185a to your computer and use it in GitHub Desktop.
Save codecademydev/108828bf9cb1969d3856e2444727185a to your computer and use it in GitHub Desktop.
Codecademy export
class Circle:
pi = 3.14
def __init__(self, diameter):
print("Creating circle with diameter {d}".format(d=diameter))
# Add assignment for self.radius here:
self.radius = diameter / 2
def circumference(self):
return 2 * self.pi * self.radius
medium_pizza = Circle(12)
teaching_table = Circle(36)
round_room = Circle(11460)
print(medium_pizza.circumference())
print(teaching_table.circumference())
print(round_room.circumference())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment