Created
May 30, 2017 05:18
-
-
Save rupalbarman/d58532101beddfaa38316c2c8eb64da6 to your computer and use it in GitHub Desktop.
matrix rotation (layer wise) anti clockwise by 90 degrees
This file contains hidden or 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
a= [ | |
[1,2,3,4], | |
[5,6,7,8], | |
[9,10,11,12], | |
[13,14,15,16] | |
] | |
for _ in a: | |
print(*_) | |
print() | |
ab= [x[::-1] for x in zip(*a)] | |
ba= list(reversed([list(reversed(x)) for x in ab])) | |
for _ in ba: | |
print(*_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment