Created
March 8, 2015 03:56
-
-
Save montaro/2d5c0fecf47c7faf3f61 to your computer and use it in GitHub Desktop.
Image Rotator
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
__author__ = 'arefaey' | |
def rotate(image_matrix): | |
result = [] | |
n = len(image_matrix) | |
for i in range(n): | |
new_row = [] | |
for j in range(n): | |
new_row.append(image_matrix[n - j - 1][i]) | |
result.append(new_row) | |
return result | |
m1 = [[1, 9, 17, 8], [3, 5, 8, 2], [4, 7, 19, 33], [5, 6, 2, 11]] | |
print(rotate(m1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment