Tell us what’s happening:
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)
I have attempted this manually and copy/paste several times, even refreshed the page and worked from step 9. I have done the cipher in the old python, this won’t work for some reason.
Your code so far
# User Editable Region
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)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Caesar Cipher - Step 10