Cipher Exceeds The 4x4 Grid And Prints Out Wrong Cipher
So i have created this code below to make a 4*(the length of the cipher) grid based on the cipher text they have provided to work with any value up to 80 that is divisible by 4, i
Solution 1:
mygrid
has exactly the dimensions you want. You then call
grid2=list(zip(*mygrid))
which transforms mygrid
(4x8) into grid2
(8x4), and print
the latter. Try
for i in range (len(mygrid)):
print(mygrid[i])
or, more pythonic:
for l in mygrid:
print(l)
If you want each sub-list in mygrid
to be a list of single characters, rather than a four-character string you can do this with a small modification to your list comprehension:
mygrid = [list(decode[i:i+4]) for i in range(0,len(decode),4)]
# ^ add call to list
Post a Comment for "Cipher Exceeds The 4x4 Grid And Prints Out Wrong Cipher"