Skip to content

Instantly share code, notes, and snippets.

@SteadBytes
Last active August 10, 2017 15:59
Show Gist options
  • Save SteadBytes/2ffbc51691c2889795fec36e9c5ea9fc to your computer and use it in GitHub Desktop.
Save SteadBytes/2ffbc51691c2889795fec36e9c5ea9fc to your computer and use it in GitHub Desktop.

Symmetric Matrix

A matrix is symmetric if the first row is the same as the first column, the second row is the same as the second column etc… Write a function to determine whether a matrix is symmetric.

Example input and output:

print symmetric([[1, 2, 3],
                [2, 3, 4],
                [3, 4, 1]])
>>> True

print symmetric([["cat", "dog", "fish"],
               ["dog", "dog", "fish"],
               ["fish", "fish", "cat"]])
>>> True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment