Created
November 8, 2013 14:16
-
-
Save sinistersnare/7371620 to your computer and use it in GitHub Desktop.
Showing a CS1 kid classes!
This file contains 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,y): | |
self.x = x | |
self.y = y | |
def set(self,x,y): | |
self.x = x | |
self.y = y | |
def getx(self): | |
return self.x | |
def gety(self): | |
return self.y | |
def __str__(self): | |
return "<Point: {},{}>".format(self.x,self.y) | |
def main(): | |
pos = Point(2,3) | |
newx, newy = raw_input('new x: '), raw_input('new y: ') | |
pos.set(newx,newy) | |
print pos | |
print str(pos) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment