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 bartorbard
def convertion(maps):
rows = len(maps)
column = len(maps[0])
n=0
m=0
theSum=0
transposed = []
for i in range(rows):
transposed.append([row[i] for row in maps])
for i in range(rows):
for p in range(column):
if maps[m][n] == -(transposed[m][n]):
theSum=theSum+1
n=n+1
n=0
m=m+1
if theSum==(rows*column):
return(True)
else:
return(False)
def checkio(matrix):
x=convertion(matrix)
return x
#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"
Dec. 3, 2016