Question: First, write a new function in the crypto.py file called encrypt that takes a message and encrypts it using the shift cipher with a specified

 First, write a new function in the crypto.py file called encryptthat takes a message and "encrypts it using the shift cipher with

First, write a new function in the crypto.py file called encrypt that takes a message and "encrypts it using the shift cipher with a specified shift and alphabet. The signature and return type are given by encrypt (message : str, shift : int, alphabet : str) => str A positive shift replaces a letter with the letter -shift- places to the right in the given alphabet. A negative shift replaces a letter with the letter that is - shift- places to the left. This is applied to each letter in the message to create the outputted ciphertext. Here is some example usage of the function >>>encrypt ('abcd', 2, "abcd_") 'cda' >>>encrypt ('abcd', -2, "abcd ") 'd ab' >>>encrypt ('abcxyz', 2, "abcdefghijklmnopqrstuvwxyz") 'cdezab' Next, add another function to the crypto.py file called passwordsValid that takes a string as input and outputs whether or not the string is a valid password (True/False). The rules for a valid password are given by . All passwords must be at least 5 characters long All passwords must have at least two digits in it [0,1,2,...,9] All passwords must have at least one special character in it [!@#$%^_-) (not including []) All passwords must have at least one uppercase letter All passwords must have at least one lowercase letter All password must start with either a letter or an underscore . The signature and return type is given by passwordIsValid (passwd : str) -> bool Example, >>>passwordIsValid ('cat') False >>>passwordIsValid ('k1TT3n$') True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!