title: (Python) Script to determine if (x, y) coordinates are colinear - getting some errors
body: <p>like the title says, I'm trying to write a program that takes a list of (x, y) coordinates, and determines if any 3 points are collinear (lie on a line with the same slope)</p>
  
  <p>I'm getting some error messages.  As it stands, I get an "TypeError: 'int' object is not subscriptable" message.  If I take out the part where collinearityTest calls on the areCollinear function, I get an "index out of range" error.  I'm new to python, and just trying to learn.  </p>
  
  <pre><code>def areCollinear(p1, p2, p3):
      slope1 = (p2[1] - p1[1]) / (p2[0] - p1[0])
      slope2 = (p3[1] - p2[1]) / (p3[0] - p2[0])
      if slope1 == slope2:
          print "Points are colinear"
      else:
          print "Points are NOT colinear, what's the matter with you?"
  
  def collinearityTest(pointList):
      position = 0
      while position &gt;=0 and position &lt; len(pointList):
  
          for p1 in pointList[position]:
              position = position + 1
              for p2 in pointList[position]:
                  position = position + 1
                  for p3 in pointList[position]:
                      position = position + 1
                      areCollinear(p1, p2, p3)
  
  pointList = [(10, 20), (55, 18), (10, -45.5), (90, 34), (-34, -67), (10, 99)]
  
  collinearityTest(pointList)
  </code></pre>
  
  <p>ERROR MESSAGE:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 23, in &lt;module&gt;
    File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 19, in collinearityTest
    File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 2, in areCollinear
      if __name__ == '__main__':
  TypeError: 'int' object is not subscriptable
  </code></pre>