Coordinate Grid Points
Matimus
mccredie at gmail.com
Tue Feb 6 19:13:00 EST 2007
[code]
#classify "Point"
class Point(object):
def _init_(self, x, y): <--- This is your problem
self.x = x
self.y = y
[/code]
That should be '__init__'. Two underscores before and after. But,
IMHO, I don't think a class is really necessary unless you are going
to build in compare facilities. You might as well just use a tuple:
[code]
from random import randint
pt = (randint(1,20),randint(1,20))
...
x,y = pt
x = pt[0]
y = pt[1]
[/code]
More information about the Python-list
mailing list