Copy upper triangle to lower triangle in a python matrix

后端 未结 5 1727
耶瑟儿~
耶瑟儿~ 2020-12-24 01:31
       iluropoda_melanoleuca  bos_taurus  callithrix_jacchus  canis_familiaris
ailuropoda_melanoleuca     0        84.6                97.4                44
bos_tau         


        
5条回答
  •  梦毁少年i
    2020-12-24 02:12

    If I understand the question correctly, I believe this will work

    for i in range(num_rows):
        for j in range(i, num_cols):
            matrix[j][i] = matrix[i][j]
    

提交回复
热议问题