The concept is simple. I want to create a list of 26 by 26 and fill it with the alphabet. Except that each time, I have to shift one letter to the right.
Example:
- A, B, C, E, F, G...
- Z, A, B, C, E, F, G...
- Y, Z, A, B, C, E, F, G...
I made this code which works but it displayed the basic alphabet at the end. Looks like the array is resseted to the basic alphabet.
alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
import numpy as np
Tableau=np.empty((26,26),dtype='<U1')
for k in range(len(alphabet)):
for i in range(len(alphabet)):
if i + k >= len(alphabet):
i += k - len(alphabet)
else:
i += k
Tableau[k][i] = alphabet[i]
print(Tableau[k][i])
print(alphabet[i], "\n")
I get ['A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R'
'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z']
26 times instead of getting the right result.