• + 0 comments

    For Python3 Platform

    Mathematics Logic - Using combinations. Here it is nc2 = n*(n-1)/2

    I wrote the code from scratch just to get more practice
    def handshakes(n):
        return (n*(n-1))//2
    
    t = int(input())
    for i in range(t):
        n = int(input())
        
        result = handshakes(n)
        
        print(result)