Tell us what’s happening:
the order is to Delete encryption and the print(encryption) call. Also, comment out the last two lines of your code.
and i couldn’t pass it
Your code so far
# User Editable Region
text = 'Hello Zaira!'
custom_key = 'python'
def vigenere(message, key, direction):
key_index = 0
alphabet = 'abcdefghijklmnopqrstuvwxyz'
translated_text = ''
for char in message.lower():
if not char.isalpha():
translated_text += char
else:
key_char = key[key_index % len(key)]
key_index += 1
offset = alphabet.index(key_char)
index = alphabet.find(char)
new_index = (index + (offset * direction)) % len(alphabet)
translated_text += alphabet[new_index]
return translated_text
def encrypt(message, key):
return vigenere(message, key, 1)
def decrypt(message, key):
return vigenere(encryption, key, -1)
#decryption = decrypt(encryption, custom_key)
#print('plain text:', text)
#print('decrypted text:', decryption)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 88