<jupyter_start><jupyter_text>Given n points in a Cartesian coordinate system, count the number of Triples that are collinear. Three points P, Q, R are said to be collinear if they lie on a single straight line.<jupyter_code>import itertools
import math

def distance(q, p):
    dist = math.sqrt((q[0] - p[0])**2 +(q[1] - p[1])**2)
    return dist
        
def collinear(A):
    triplets = [list(x) for x in itertools.combinations(A, 3)]
    count = []
    for item in triplets:
        
       
        all_distance = [ distance(item[0], item[1]), distance(item[0], item[2])
        ,distance(item[1], item[2])]
        all_distance.sort()
        
        
        if all_distance[2] == all_distance[0] + all_distance[1]:
            count.append(item)
            
        else:
            continue
            
            
    print(*count,sep='\n')<jupyter_output><empty_output><jupyter_text>Test Code<jupyter_code>points = [[1,-1],[2,1],[-3,3],[0,0],[5,4],[6,-1],[3,7],[8,2],[9,9],[10,10]]
collinear(points)<jupyter_output>[[1, -1], [5, 4], [9, 9]]
[[0, 0], [9, 9], [10, 10]]
{'fraction_non_alphanumeric': 0.17467652495378927, 'fraction_numerical': 0.04805914972273567, 'mean_word_length': 2.773519163763066, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '143253', 'license': 'MIT', 'n_tokens_mistral': 418, 'n_tokens_neox': 394, 'n_words': 91, 'path': 'Collinear.ipynb', 'repo_name': 'masoumehnb/Interview-Questions', 'size': '1082'}