# D. Scott # CCI - Problem 1.7 # Rotate an N x N image matrix 90 degrees to the right size = input("What size (N) will your matrix be? ") count = 0 matrix = [] row = [] while (count < int(size)*int(size)): n=input("Enter an integer: ") row.append(n) count += 1 if (count != 0 and count % int(size) == 0): matrix.append(row) row = [] for i in range(0,int(size)): print(matrix[i]) for i in range(0,int(size)-1): for j in range(i+1,int(size)): temp = matrix[i][j] matrix[i][j] = matrix[j][i] matrix[j][i] = temp print("\nRotated:") for i in range(0,int(size)): matrix[i].reverse() print(matrix[i]) # D. Scott # CCI - Problem 1.7 # Rotate an N x N image matrix 90 degrees to the right size = input("What size (N) will your matrix be?") count = 0 matrix = [] row = [] while (count < int(size)*int(size)): n=input("Enter an integer: ") row.append(n) count += 1 if (count != 0 and count % int(size) == 0): matrix.append(row) row = [] for i in range(0,int(size)): print(matrix[i]) for i in range(0,int(size)-1): for j in range(i+1,int(size)): temp = matrix[i][j] matrix[i][j] = matrix[j][i] matrix[j][i] = temp print("\nRotated:") for i in range(0,int(size)): matrix[i].reverse() print(matrix[i]) # D. Scott # CCI - Problem 1.7 # Rotate an N x N image matrix 90 degrees to the right size = input("What size (N) will your matrix be? ") count = 0 matrix = [] row = [] while (count < int(size)*int(size)): n=input("Enter an integer: ") row.append(n) count += 1 if (count != 0 and count % int(size) == 0): matrix.append(row) row = [] for i in range(0,int(size)): print(matrix[i]) for i in range(0,int(size)-1): for j in range(i+1,int(size)): temp = matrix[i][j] matrix[i][j] = matrix[j][i] matrix[j][i] = temp print("\nRotated:") for i in range(0,int(size)): matrix[i].reverse() print(matrix[i])