Build a Caesar Cipher - Step 15

Tell us what’s happening:

I do not get the instructions. All of the character are capitalized. Here is what I have:

translation_table = str.maketrans(alphabet.upper(), shifted_alphabet.upper())

I also tried translation_table = alphabet.upper() + shifted_alphabet.upper())

translation_table = str.maketrans(alphabet.upper() + shifted_alphabet.upper())
return text.translate(translation_table)

Your code so far

def caesar(text, shift):
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    shifted_alphabet = alphabet[shift:] + alphabet[:shift]

# User Editable Region

    translation_table = str.maketrans(alphabet.upper() + shifted_alphabet.upper())

# User Editable Region

    return text.translate(translation_table)

encrypted_text = caesar('freeCodeCamp', 3)
print(encrypted_text)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 15

Update your str.maketrans() call by concatenating to each argument the uppercase version of the argument itself.

This instruction asks for something more like this:

str.method(argument + argument.upper())

I see the issue. I did not separate the maketrans method with a comma. I think I still get the same results with the code above. Why is the comma needed?

str.maketrans(alphabet, shifted_alphabet)

There are two arguments. Comma separates the arguments.

I was confused with this part as well; I just didn’t understand correctly. Running theme I am having. But I was able to pass it by adding the arguments twice, one with no upper and one with upper, and concatenating (adding) them together, then separating them with a comma between alphabet and shifted_alphabet.

code removed by moderator

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.