I am trying to generate a Vigenère Cipher Table and store it as an array where each row on the table is an individual list entry inside of the list vCipherChart. Ideally vCipherChart would output:
[["A","B","C"...],["B","C","D"...] ... ["Z","A","B"...]]
However when I run my code it returns:
[["Z","A","B"...],["Z","A","B"...] ... ["Z","A","B"...]]
I am unsure what is causing this, as I am appending the new list entries generated by cycleAlphabet to the variable vCipherChart. Any help would be much appreciated!
import array
def cycleAlphabet(alphabet):
newLastEntry = alphabet[0]
alphabet.remove(newLastEntry)
alphabet.append(newLastEntry)
return alphabet
def generateCipherChart():
vCipherChart = [["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"]]
i = 0
while i < 25:
alphabet = vCipherChart[i]
newAlphabet = cycleAlphabet(alphabet)
vCipherChart.append(newAlphabet)
i+=1
return vCipherChart
print(generateCipherChart())