Bifid cipher: Difference between revisions

m
Python: Remove unnecessary list comprehension
(Add Python)
m (Python: Remove unnecessary list comprehension)
Line 296:
_map = polybius_map(square)
return "".join(
square[x - 1][y - 1]
for square[x, - 1][y -in 1]group(
chain.from_iterable(zip(*(_map[c] for x,c yin message if c in group(_map))),
)2,
chain.from_iterable(zip(*[_map[c] for c in message if c in _map])),
2,)
)
]
)
 
Line 310 ⟶ 308:
_map = polybius_map(square)
return "".join(
square[x - 1][y - 1]
for square[x, - 1][y -in 1]zip(
for x, y in zip*group(
*groupchain.from_iterable((_map[c] for c in message if c in _map)),
chain.from_iterablelen([_map[c] for c in message if c in _map]),
len(message),
)
)
])
)
 
 
def normalize(smessage: str) -> str:
"""Normalize a message for the typical Polybius square."""
return smessage.upper().replace("J", "I")
 
 
140

edits