Skip to content

Instantly share code, notes, and snippets.

@anddam
Created December 29, 2016 23:15
Show Gist options
  • Select an option

  • Save anddam/5eb33994fc900f5a92cbd7db6665bc12 to your computer and use it in GitHub Desktop.

Select an option

Save anddam/5eb33994fc900f5a92cbd7db6665bc12 to your computer and use it in GitHub Desktop.
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
['.', 'O', 'O', 'O', 'O', 'O'],
['O', 'O', 'O', 'O', 'O', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['.', '.', '.', '.', '.', '.'],]
rotated = []
for row in grid:
for index, item in enumerate(row):
try:
rotated[index].append(item)
except:
rotated.append([item])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment