You are viewing a single comment's thread. Return to all comments →
def handshakes(n): return (n*(n-1))//2 t = int(input()) for i in range(t): n = int(input()) result = handshakes(n) print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Handshake
You are viewing a single comment's thread. Return to all 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