# Python Compile Error

• does OJ support Python import collections Counter? (yes)

Thanks!

update:

can you help me look at my code at https://oj.leetcode.com/submissions/detail/8630902/ ?

``````class Solution:
# @param points, a list of Points
# @return an integer
def maxPoints(self, points):
def eval(a, b):
if a.x-b.x == 0 and a.y-b.y == 0:
return 'identical'
if a.x-b.x == 0:
return float("inf")
return (float(a.y-b.y)/(a.x-b.x))
if len(points) == 0:
return 0
slopematrix = [[eval(a,b) for b in points] for a in points]
MaxPoints = 0
for idx, slopes in enumerate(slopematrix):
counter = collections.Counter(slopes)
for i in counter.most_common():
slope = i[0]
count = i[1]
if slope == 'identical' and count > MaxPoints:
MaxPoints = count
count = i[1] + counter['identical']
if slope != 'identical' and slope != float("inf") and count > MaxPoints:
MaxPoints = count
return MaxPoints``````

• Yes, we imported `collections`. So, please use 'Counter' as below:

``````    cnt = collections.Counter()
``````

• Ok so it's not the reason for compile error

• I keep getting `Runtime Error` without any additional message... Tried a few test cases on my local machine and it passed successfully. Have no idea why it happens.

Edit: figured out mine was because of something like `max([])`.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.