views:

21

answers:

1

I've been using The New Boston tutorial (http://www.youtube.com/watch?v=x9M3R6igH2E) on how to program with pygame and I keep getting an "invalid syntax" error on the print self.diff command. Only the self is highlighted. Here is the code (i've bolded the problem):

class vector(object):

def __init__(self, list1, list2):
    self.diff=(list2[0]-list1[0], list2[1]-list1[1])
    print **self**.diff

a =(20.0, 25.0) b =(40.0, 55.0) thing=vector(a,b)

+2  A: 

Python 3? If so, arguments to print must be enclosed in parentheses: print(self.diff).

If your learning materials and tutorials are based on the Python 2.x branch, you won't be too lucky with Python 3. Otherwise it's a great choice because it cleans up with many of the issues of the older Python versions.

Alexander Gessler