Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 354 Bytes

38.md

File metadata and controls

14 lines (12 loc) · 354 Bytes
def matrixRound(M, decPts=4):
    # 对行循环
    for index in range(len(M)):
        # 对列循环
        for _index in range(len(M[index])):
            M[index][_index] = round(M[index][_index], decPts)  

说明:

  • 其中matrixRound函数就是解决问题的方案
  • M 是传入的矩阵
  • decPts 是要处理的元素的位数