Definition and test function for class Point. : Class Definition : Class PYTHON examples


PYTHON examples » Class » Class Definition »

 

Definition and test function for class Point.


 

class Point:
   def __init__self, xValue = 0, yValue = ):
      self.x = xValue
      self.y = yValue

   def __str__self ):
      return "( %d, %d )" self.x, self.y )      


point = Point72115 )

print "X coordinate is:", point.x
print "Y coordinate is:", point.y

point.x = 10
point.y = 10

print "The new location of point is:", point   

   
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Class
» Class Definition