ZadanieDomowe/Lab3/zad7.py

21 lines
454 B
Python
Raw Normal View History

2024-12-02 19:19:02 +01:00
def my_encode(message):
encoded_message = ''
for char in message:
encoded_message += chr(ord(char) + 7)
return encoded_message
def my_decode(message):
decoded_message = ''
for char in message:
decoded_message += chr(ord(char) - 7)
return decoded_message
message = "Witam"
encoded = my_encode(message)
decoded = my_decode(encoded)
print(f" Encoded: {encoded}")
print(f"Decoded: {decoded}")