Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Skew-symmetric Matrix by stanwys
def checkio(mx):
dl=len(mx)
g=True
end=False
while(g==True and end==False):
for j in range(0,dl-1):
for i in range(j+1,dl):
if((mx[j][i]+mx[i][j])!=0):
g=False
for i in range(0,dl):
if(mx[i][i]!=0):
g=False
end=True
return g
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio([
[0, 1, 2],
[-1, 0, 1],
[-2, -1, 0]]) == True, "1st example"
assert checkio([
[0, 1, 2],
[-1, 1, 1],
[-2, -1, 0]]) == False, "2nd example"
assert checkio([
[0, 1, 2],
[-1, 0, 1],
[-3, -1, 0]]) == False, "3rd example"
Oct. 29, 2016