Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Last active May 2, 2020 05:03
Show Gist options
  • Select an option

  • Save StrikingLoo/dd232c142547b5ef3314bd11d7144426 to your computer and use it in GitHub Desktop.

Select an option

Save StrikingLoo/dd232c142547b5ef3314bd11d7144426 to your computer and use it in GitHub Desktop.
id_matrix = [[1,0,0],
[0,1,0],
[0,0,1]]
vector_version = [n for row in id_matrix for n in row]
@hridyeshpant

Copy link
Copy Markdown

looks wrong to me, it should be
vector_version = [row for row in id_matrix for row in row]

in your getting error saying row in undefined

@Baymax15

Baymax15 commented Jan 9, 2020

Copy link
Copy Markdown

vector_version = [row for row in id_matrix for row in row]

Might as well change the variable names to avoid confusion. ❤️

vector_version = [n for row in id_matrix for n in row]

@StrikingLoo

Copy link
Copy Markdown
Author

Thanks guys, I fixed it now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment