Manipulating Arrays and Lists Help

This is the place for queries that don't fit in any of the other categories.

Manipulating Arrays and Lists Help

Postby joedirgy » Tue Nov 19, 2013 4:23 am

Hello, I am trying to create a very simple column transposition cipher for my class. I have the code nearly complete. I am just having problems understanding how to use lists.

When I have a list here "Plain Text"
Code: Select all
q   z   s   e   c   f   t   b
a   w   x   d   r   v   g   y

I can change it to this "Current Cipher"
Code: Select all
c   f   t   b   e   s   z   q
r   v   g   y   d   x   w   a

Which is the correct order but instead of going down each column row by row I would like it to go all the way down the row so it should look like this:
Code: Select all
c   r   f   v   t   g   b   y
e   d   s   x   z   w   q   a

---------------------------------------------> then down
----------------------------------------------> done

My current code
Code: Select all
#Current Cipher Code
for column in range(0,8):
       for row in range(0,result):
            cipherbucket[row][(int(numlist[column]))] = buckets[row][column]

printerHelper(decipherbucket)

def printerHelper(list):
  for item in list:
    print item[0], ', '.join(map(str, item[1:]))


This code prints out
Code: Select all
c f, t, b, e, s, z, q
r v, g, y, d, x, w, a


The origin matrix was
Code: Select all
q z, s, e, c, f, t, b
a w, x, d, r, v, g, y


It should be
Code: Select all
c   r   f   v   t   g   b   y
e   d   s   x   z   w   q   a
But I am stuck at the moment. Any help or ideas anyone could provide would be very appreciated.
Thanks,
Joe
Last edited by Mekire on Tue Nov 19, 2013 4:29 am, edited 1 time in total.
Reason: First post lock.
joedirgy
 
Posts: 3
Joined: Tue Nov 19, 2013 3:59 am

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 2 guests