alphabet = ‘abcdefghijklmnopqrstuvwxyz’
shift = 5
text = ‘hello’
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet, shifted_alphabet)
encrypted_text = text.translate(translation_table)
print(encrypted_text) Create a function named caesar. Put all your existing code within the function body. Pay attention to keep the same indentation level for all of the lines within the function body.
Lesson URL (copy - paste from your browser’s address bar)
Can you please link to the url of the step you are on.
For future reference:
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
With Python, we particularly need to see your code formatted to retain the indentation.
Please re-post your code, formatted as follows, along with a link to the challenge step:
There are two ways you can format your code to make it easier to read and test:
After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)
Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.
To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor: