Python - Algorithm to determine if a list is symmetric

前端 未结 6 1710
灰色年华
灰色年华 2021-01-22 00:01

So I\'m stuck on this problem where I\'ve been asked to write an function in Python that checks to see if an n-dimensional array (is that what they\'re called?) is \"symmetric\"

6条回答
  •  梦谈多话
    2021-01-22 00:31

    A version for Python3

    def symmetric(L)
        return all(i==j for i,*j in zip(L ,*L))
    

提交回复
热议问题