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

Function encrypt

ciphers/morse_code.py:25–32  ·  view source on GitHub ↗

>>> encrypt("Sos!") '... --- ... -.-.--' >>> encrypt("SOS!") == encrypt("sos!") True

(message: str)

Source from the content-addressed store, hash-verified

23
24
25def encrypt(message: str) -> str:
26 """
27 >>> encrypt("Sos!")
28 '... --- ... -.-.--'
29 >>> encrypt("SOS!") == encrypt("sos!")
30 True
31 """
32 return " ".join(MORSE_CODE_DICT[char] for char in message.upper())
33
34
35def decrypt(message: str) -> str:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected