Tell us what’s happening:
I’m unclear what step 15 is asking to do and where the ‘upper’ needs to be added.
Your code so far
def caesar(text, shift):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
# User Editable Region
translation_table = str.maketrans.upper(alphabet, shifted_alphabet)
# 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/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Challenge Information:
Build a Caesar Cipher - Step 15
dhess
2
Hi @BrianL1018 ,
Update your str.maketrans() call by concatenating to each argument the uppercase version of the argument itself.
What are the two arguments passed to str.maketrans()? Take each argument and concatenate the same argument with upper() applied.
Happy coding!
The two arguments are alphabet and shifted_alphabet, but I am still lost on what to do
dhess
4
Do you understand how to concatenate one variable to another?
dhess
6
Okay, so take the first argument and concatenate it to the same first argument with upper() applied. What would that be?
alphabet+alphabet.upper()
shifted_alphabet+shifted_alphabet.upper()
2 Likes
Got it, thanks for the help
1 Like
@BrianL1018 Could you mark the post as solved and give credit to the user who helped you solve your question. Happy Coding! and Happy Easter!
1 Like