Convert each letter of the input string into their respective trigram values, join them and split them into three equal groups of strings which are returned. >>> __decrypt_part('ABCDE', TEST_CHARACTER_TO_NUMBER) ('11111', '21131', '21122')
(
message_part: str, character_to_number: dict[str, str]
)
| 38 | |
| 39 | |
| 40 | def __decrypt_part( |
| 41 | message_part: str, character_to_number: dict[str, str] |
| 42 | ) -> tuple[str, str, str]: |
| 43 | """ |
| 44 | Convert each letter of the input string into their respective trigram values, join |
| 45 | them and split them into three equal groups of strings which are returned. |
| 46 | |
| 47 | >>> __decrypt_part('ABCDE', TEST_CHARACTER_TO_NUMBER) |
| 48 | ('11111', '21131', '21122') |
| 49 | """ |
| 50 | this_part = "".join(character_to_number[character] for character in message_part) |
| 51 | result = [] |
| 52 | tmp = "" |
| 53 | for digit in this_part: |
| 54 | tmp += digit |
| 55 | if len(tmp) == len(message_part): |
| 56 | result.append(tmp) |
| 57 | tmp = "" |
| 58 | |
| 59 | return result[0], result[1], result[2] |
| 60 | |
| 61 | |
| 62 | def __prepare( |
no test coverage detected