Question: 7 . 1 5 HW 2 , Question 2 We are trying to make sure your passphrase is acceptable! Write a script that asks for
HW Question
We are trying to make sure your passphrase is acceptable! Write a script that asks for an input string that will be used as your passphrase.
This input string must have three "words" separated by a space character. Each of these words has specific requirements, listed below.
You must write a function for each requirement three total functions because we will be using unit tests for grading this problem, meaning
we will be checking the correctness of your functions individually in addition to checking your overall output. Unit testing is common
practice, so it is good to become familiar with the idea of testing independent parts of your code as you develop. Make sure your functions
follow the original template provided.
First Function: For the first word, you must check if it is a palindrome meaning it is the same forward and backward, like "glolg" or
"tacocat" is caseinsensitive so "GfraaRFg" or "VObov" are valid and only uses alphabetical letters treert" and ff are not
valid
Second Function: For the second word, you must check if it is a positive integer with at least digits, containing only numeric characters
ie no alphabetic, punctuation, or special characters
Third Function: For the third word, you must check if it starts with one of these special characters @$& ends with a
punctuation mark only commas periods exclamation marks and question marks are allowed and has three letters in
between the special character and punctuation mark eg@dog! or $tpb or cat,"
If the entire password meets all the correct specifications, then print 'valid'; otherwise, print 'invalid'.
For example, the password "taCocaT @LAg!" should evaluate to True while the password "blarg oops." should evaluate to False.
Download
# Each of these functions should return a Boolean value, ie return True if the
# conditions are satisfied and False otherwise. They should all operate on
# string inputs.
# This function checks if the input is a caseinsensitive palindrome string of
# only alphabetic characters.
def palindromeword:
# This function checks if the input string is an integer with at least digits.
def integerword:
# This function checks if the input starts with special character from the list
# @$& then has alphabetical characters, and then ends with
# punctuation character from the list
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
