I'm taking on a project for university! Programming in python, I need to make a function called generate_key
that receives an argument called letters
, which is a tuple of 25 characters. The function should return a tuple of 5 tuples of characters, each one with 5 elements, that are the letters disposed by lines.
For example:
>>> letters = (‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, \
... ‘H’, ‘I’, ‘J’, ‘ ’, ‘L’, ‘M’, ‘N’, \
... ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, \
... ‘V’, ‘X’, ‘Z’, ‘.’)
>>> generate_key(letters)
... ((‘A’, ‘B’, ‘C’, ‘D’, ‘E’),
... (‘F’, ‘G’, ‘H’, ‘I’, ‘J’),
... (‘ ’, ‘L’, ‘M’, ‘N’, ‘O’),
... (‘P’, ‘Q’, ‘R’, ‘S’, ‘T’),
... (‘U’, ‘V’, ‘X’, ‘Z’, ‘.’))