mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Fix invalid escape sequence in binary_search_tree.py (#1920)
* Fix invalid escape sequence in binary_search_tree.py
data_structures/binary_tree/binary_search_tree.py:156
/home/travis/build/TheAlgorithms/Python/data_structures/binary_tree/binary_search_tree.py:156: DeprecationWarning: invalid escape sequence \
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ https://www.dcode.fr/letter-number-cipher
|
||||
http://bestcodes.weebly.com/a1z26.html
|
||||
"""
|
||||
|
||||
|
||||
def encode(plain: str) -> list:
|
||||
"""
|
||||
>>> encode("myname")
|
||||
@@ -13,6 +14,7 @@ def encode(plain: str) -> list:
|
||||
"""
|
||||
return [ord(elem) - 96 for elem in plain]
|
||||
|
||||
|
||||
def decode(encoded: list) -> str:
|
||||
"""
|
||||
>>> decode([13, 25, 14, 1, 13, 5])
|
||||
@@ -20,10 +22,12 @@ def decode(encoded: list) -> str:
|
||||
"""
|
||||
return "".join(chr(elem + 96) for elem in encoded)
|
||||
|
||||
|
||||
def main():
|
||||
encoded = encode(input("->").strip().lower())
|
||||
print("Encoded: ", encoded)
|
||||
print("Decoded:", decode(encoded))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user