Created
December 15, 2016 19:54
-
-
Save albertstartup/3099dbed2403486dad832308c9e27539 to your computer and use it in GitHub Desktop.
make shift matrix using list comprehension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def makeshiftmatrix(upper_or_lower, row, column): | |
return [[1 if item_idx == row_idx+upper_or_lower else 0 for item_idx in range(0, column)] for row_idx in range(0, row)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment