MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / main

Function main

ciphers/transposition_cipher.py:11–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9
10
11def main() -> None:
12 message = input("Enter message: ")
13 key = int(input(f"Enter key [2-{len(message) - 1}]: "))
14 mode = input("Encryption/Decryption [e/d]: ")
15
16 if mode.lower().startswith("e"):
17 text = encrypt_message(key, message)
18 elif mode.lower().startswith("d"):
19 text = decrypt_message(key, message)
20
21 # Append pipe symbol (vertical bar) to identify spaces at the end.
22 print(f"Output:\n{text + '|'}")
23
24
25def encrypt_message(key: int, message: str) -> str:

Callers 1

Calls 2

encrypt_messageFunction · 0.70
decrypt_messageFunction · 0.70

Tested by

no test coverage detected