Build a Caesar Cipher - Step 11 in:title

This is as far as I have managed to code the Caesar cipher.

def caesar():

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    shift = 5

    shifted_alphabet = alphabet\[shift:\] + alphabet\[:shift\]

    translation_table = str.maketrans(alphabet, shifted_alphabet)

    text = 'hello world'

    encrypted_text = text.translate(translation_table)

    print(encrypted_text)

def caesar (text,shift):

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    offsetted_alphabet = alphabet\[offset:\] + alphabet\[:offset\]

    translation_table = str.maketrans(alphabet, offsetted_alphabet)

    message = 'hello world'

    encrypted_message = message.translate(translation_table)

`
Instructions are not to use text and shift, so i changed to messge and offset. It still did not pass. Please help.

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

try this

code removed by moderator

hi @kukku1996

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge. How to Help Someone with Their Code Using the Socratic Method

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.