Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with the first two tests. Problem 2 - Passphrase Check (40 points) We are trying to make sure your passphrase is acceptable!

image text in transcribedPlease help me with the first two tests.

Problem 2 - Passphrase Check (40 points) 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 password. This input string will 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). Make sure your functions follow the original template that provided. First Function: For the first word, you must check if it is a palindrome (it is the same forward and backward, like 'glolg' or 'tacocat"), is case-insensitive so "GfraaRFg" or "Vobov" are valid), and only uses alphabetical letters ("tre3ert' and 'fh,@s@h'f" are not valid). Second Function: For the second word, you must check if it is a positive integer with at least 4 digits, containing only numeric characters (i.e. 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 (e.g. "@dog!" or "Stpb?" or "cat"). If the entire password meets all the correct specifications, then print "valid", otherwise, print 'invalid". Template Functions (DO NOT CHANGE FUNCTION NAMES): def palindrome (): def integer(): def special(): ACTIVITY 4.20.1: Programming Assignment 2 - Problem 2 22 / 40 main.py 1 def palindrone(s): 2 return s.lower()==(-1::-1).lower() 4 det integer(s): for x in su if not x.isdigit(): return false return len(s)>=4 10 det special(s): 11 it s[@] in @$%^&' and [-1] in ', .!?': for x in s[1:-2): if not x.isalpha(): return false return len(s)==5 return false 16 18 if 29 name E main": words = input('').split() if palindrone (words[e]) and integer(words[1]) and special(words[2]): print("valid') else: print('invalid') 22 Develop mode Submit mode When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Submit for grading Latest submission - 1:42 PM on 02/04/20 Total score: 22 / 40 Only show failing tests Download this submission 1: Palindrome Test A 0/10 tests if your palindrome function works correctly Test feedback incorrectly returns False for a non-alphabetic input 2: Integer Test A 0/8 tests if your integer function works correctly Test feedback incorrectly returns True for a non-integer input 3: Special Test 10/10 tests if your special function works correctly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

3031001257, 978-3031001253

More Books

Students also viewed these Databases questions

Question

Complexity of linear search is O ( n ) . Your answer: True False

Answered: 1 week ago