Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Skew-symmetric Matrix by MedykMatyk
def checkio(matrix):
for i in range(len(matrix)):
for j in range(len(matrix[0])):
print("[" + str(i) + "] [" + str(j) + "] != [" + str(len(matrix)-i-1) + "] [" + str(len(matrix)-j-1) + "]")
print(str(matrix[i][j]) + "!=" + str(-matrix[len(matrix)-i-1][len(matrix)-j-1]))
#if(matrix[i][j]!=-matrix[len(matrix)-i-1][len(matrix)-j-1]):
#print(str(matrix[i][j))
if(matrix[i][j]!=(-matrix[j][i])):
return False
#print ("Size: " + str(len(matrix)))
#print (str(matrix[0][1]))
return True
#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"'''
assert checkio([
[0, 1, 2, 3, 4],
[-1, 0, 5, 6, 7],
[-2, -5, 0, 8, 9],
[-3, -6, -8, 0, 0],
[-4, -7, -9, 0, 0]]) == True, "Additional"
Jan. 12, 2018