I'm actually trying to create a function to turn a bi-dimensionnal list at 90° on the left or the right (it must work for n line and n column). I found a way to do it with two loops "for", but it tells me that the generator is not subscriptable when I try to call that function. As I started Python one month ago, I don't have any idea of what a generator is, and I didnt undestand what I found on the net. By the way, I have troubles to research answers hidden in other posts because of the language.
Here's the code to turn to the right :
def Rotationversdroite(m,liste):
i = 0
x, y = 0, 0
z = m - 1
listebis = ([0]*(m) for i in range(m))
for x in range(m):
for y in range(m):
listebis[y][z-x] = liste[x][y]
return listebis