Learn string manipulation by building a cipher - Step 81

Hello, I have a question. Although, I got it right; I want to make sure I’m understanding what is happening here…

In step 81, it states: Next, modify your encryption and decryption variables by calling encrypt and decrypt , respectively.

================

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)

==================

# Q1. Is this function [encrypt] returning another function [vigenere]??

#Q2. Is the function [encrypt] passing the parameters [message, key] to the function [vigenere] 's parameters*??*

no, it doesn’t return the function vigenere, it returns the output from the function vigenere

the vigenere function is called with the parameters of encrypt as arguments, yes

Hello, thank you for the quick response! I’m still new to python and these modules and forums as been alot of help for me!

for Q1, So that understand this correctly, the function [encrypt] is executing the function [vigenere]. is that safe to say?

Yes, basically

return vigenere(message, key)

The return statement is calling the vigenere function with those arguments, that function will be executed first and then the result will be returned from the encrypt function. Nested function calls.

You would say the encrypt function calls the vigenere function.