Python Forum

Full Version: Bifid Genkey (Urgent)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I need help in Bifid Key Generation

I have Skeleton file:

def uoc_bifid_genkey(keyword, period):
    """
    EXERCISE 1: Bifid Key Generation
    :keyword: string with the key word
    :period: period of the groups
    :return: list with the matrix and the period
    """

    square = []

    # --- IMPLEMENTATION GOES HERE ---

    # --------------------------------

    return [square, period]
And I have test file with this code:

 def test_1(self):
        key = uoc_bifid_genkey("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 5)
        exp_key = [[['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', '0', '1', '2', '3'], ['4', '5', '6', '7', '8', '9']], 5]
        self.assertEqual(key, exp_key)
Please help me to solve this. I am new in Phython.

Thanks in advance
What have you tried so far?
Sorry, didn't see for lack of code tags
Since this was marked as urgent I imagine the OP's deadline has past, but in general this is a good example of a thread that could have been written better. I know nothing about Bifid Key Generation, and the OP didn't help us to help them by providing any details, or an attempt with an excepted vs actual result.

To the OP: we'd be happy to help in the future, but you should really take a moment to taken our perspective - we want to help, and we'd like to do so with as little effort as possible, so explaining what you're stuck on rather than what your assignment is goes a long way.