Exercise: A method for encoding/decoding a text is based on the idea of
replace a character with the character that is a certain distance away from it.
For example, if the chosen distance is 2, then c replaces a, d
replaces b and so on. Write a program to encode
and another to decode using this method. The distance must be
a parameter of the problem and can be positive or negative. Think about how it goes
solve the case of characters at the ends of the alphabet.
#🔒 Python Homework exercise. Manipulating Strings (Coding and Decoding)
15 messages · Page 1 of 1 (latest)
@fathom jetty
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, wit...
so its easier if i convert all strings to numbers
and then add and subtract them depending of the input
!e
print(ord('a'), ord('b'))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
97 98
and then convert again
And chr is the opposite of ord.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.