Learn String Manipulation by Building a Cipher - Step 81

I’m stuck in here and have no idea how to go with this assignment. I’ve tried several things but it doesn’t work. Need some help. Here’s my screenshoot:

Hello Fish,

How many parameters does your decrypt function have?
And how many does your decrypt function call on the bottom have?

I know what you mean, but even after correcting this, it still doesn’t work!

Close, but if you look at the line (above all of this) where you declare the vigenere function. It takes 3 parameters, which currently are: (message, key, direction=1). The direction is what is important. If we call the vingenere function with only 2 arguements, that means direction will automatically be set to 1. Which is fine for encryption, but for decryption we want it to go into the other direction. To achieve this we made the decrypt function where we automatically add in -1 when we call vingenere so that now we only need to call decrypt with the encrypted message and custom key.

But right now you removed the -1 from decrypt as well. So if you use decrypt now, it will call vigenere as if it’s trying to encrypt instead of dycrypt.

Anyway, long story short. You don’t need the -1 in your decrypt call at the bottom, but you definitely still need it in the vingenere call but only in the decrypt function.

1 Like

I got a connection issue… is this right?

But ti doesn’t accept this solution either…

Please post your code instead of a screenshot. Thanks

2 Likes
def encrypt(message, key):
    return vigenere(message, key)
    
def decrypt(message, key):
    return vigenere(message, key, -1)
    
encryption = encrypt(text, custom_key)
print(encryption)
decryption = decrypt(encryption, custom_key)
print(decryption)

This passes for me, you might wanna reset the step, or reload the browser and try to submit it again.

1 Like

Yes HungryBee, it was the browser. I’m on the next. Thanks!

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.