Created
February 13, 2019 14:36
-
-
Save tormaroe/7c9745d18cdd9da56e83eb9f5bea1f78 to your computer and use it in GitHub Desktop.
Example code Python 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Point(object): | |
def __init__(self, x=0.0, y=0.0): | |
self.x = x | |
self.y = y | |
def __repr__(self): | |
return '<Point 0x%x x: %f y: %f>' % (id(self), self.x, self.y) | |
class Circle(object): | |
def __init__(self, center=None, radius=1.0): | |
self.center = center or Point() | |
self.radius = radius | |
def __repr__(self): | |
return '<Circle 0x%x x: %f y: %f radius: %f>' % ( | |
id(self), self.center.x, self.center.y, self.radius) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment