I am stuck on step 15 of the caesar cypher. It is asing me to modify the strings passes to the str.maketrans() cal using the upper () method. I feel like i have tried everytthing but still get an error
Your code so far
def caesar(text, shift):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet = alphabet.upper()
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
shifted_alphabet = shifted_alphabet.upper()
# User Editable Region
translation_table = str.maketrans(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/143.0.0.0 Safari/537.36
i believe it is asking me to alter the arguements passing to the str.maketrans function
i have tried alphabet +=alphabet.upper()
i have tried alphabet =alphabet.upper() and the same changes to shifted_alphabet but the error remains the same.
You should modify the arguments of your str.maketrans() call by concatenating to each argument the uppercase version of the argument itself. I am not sure if i understand what it means by concatenating.
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.