MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / main

Function main

ciphers/simple_substitution_cipher.py:7–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def main() -> None:
8 message = input("Enter message: ")
9 key = "LFWOAYUISVKMNXPBDCRJTQEGHZ"
10 resp = input("Encrypt/Decrypt [e/d]: ")
11
12 check_valid_key(key)
13
14 if resp.lower().startswith("e"):
15 mode = "encrypt"
16 translated = encrypt_message(key, message)
17 elif resp.lower().startswith("d"):
18 mode = "decrypt"
19 translated = decrypt_message(key, message)
20
21 print(f"\n{mode.title()}ion: \n{translated}")
22
23
24def check_valid_key(key: str) -> None:

Callers 1

Calls 3

check_valid_keyFunction · 0.85
encrypt_messageFunction · 0.70
decrypt_messageFunction · 0.70

Tested by

no test coverage detected