Return points of list2 if it occurs only once in list1

I would like your help to resolve this
I am trying to return values of list2 which occurs only once in list 1 but still it is returning all values of list 2.
Trying to Achieve: Is to get all points of a lines which are free end or not connected to any lines.

Welcome @Kumar.Bhosale
Give this a try

image

Just as an FYI, your original code looks good. This is probably an issue with point comparisons. Points often get rounded and may not match exactly due to rounding issues or approximations. You can instead convert the points to strings and use those values for comparison for better results.

That being said, @staylor’s solution is simpler and just as effective. No need to check if a point exists in the list if you’re already returning the count. Just make sure you use count == 1 or else you’ll get points that don’t exist in the list (count = 0).

Thanks @Nick_Boyts
Still learning certain aspects of python myself. I assumed he wanted both, points that didn’t occur and points that only occurred once in the list. But thanks for clarifying that.

Thanks @staylor and @Nick_Boyts
As you said the points do not have comparisons due to rounding issues.
It gives perfect solution after converting it to string.