STEP 3: We have our message, key, and alphabet! Let's make a function that will encrypt our message.

Using a function with parameters allows us to call it multiple times different arguments (values) each time.

  • From the toolkit, drag Define Function with Parameters to the bottom of the program.
  • Change the name of the function from my_function to encrypt.
  • Change the first parameter from my_var1 to message. Change the second parameter from my_var2 to key.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)