Tell us what’s happening:
i have done what step 39 has asked me to do and have added the variable to my code but this is the outcome on my code , please help me ASAP
char: h encrypted text: k
char: e encrypted text: hk
char: l encrypted text: ohk
char: l encrypted text: oohk
char: o encrypted text: roohk
char: encrypted text: croohk
char: w encrypted text: zcroohk
char: o encrypted text: rzcroohk
char: r encrypted text: urzcroohk
char: l encrypted text: ourzcroohk
char: d encrypted text: gourzcroo
Your code so far
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
# User Editable Region
for char in text.lower():
index = alphabet.find(char)
new_index = index + shift
encrypted_text = alphabet[new_index] + encrypted_text
print('char:', char, 'encrypted text:', encrypted_text)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 39