Question: I'm having a problem to do this code. Could you please help me with it This code must be in python 3 and include python
I'm having a problem to do this code. Could you please help me with it
This code must be in python 3 and include python documents.
When creating a password we normally have to follow a given set of rules. Write a program that will ask the user for a password and check if the password satisfies the following rules. The password must:
1. Be at least 8 characters in length
2. Contain at least 1 lowercase and 1 uppercase letter
3. Contain at least 1 special character (!@# $ % & *)
4. Contain at least 1 number (0-9) Your program must meet the following specifications:
1. Get a password as input from the user.
2. Check that the password satisfies the rules given above.
3. Document the program using Python comments.
4. The algorithm pseudocode should address how the code will know if all conditions are met.
2 Helpful Programming Tools
2.1 String Constants
The string class contains constants that will be very helpful for this assignment. These constants include:
string.ascii lowercase - The lowercase letters abcdefghijklmnopqrstuvwxyz.
string.ascii uppercase - The uppercase letters ABCDEFGHIJKLMNOPQRSTUVWXYZ.
string.digits - The string 0123456789.
In order to use these constants, you must have the line import string at the beginning of your Python (.py) file.
2.2 The in Operator
The in operator allows us to determine if one string is a substring of the other.
str1 in str2
Example 1: Is the character ch a vowel?
def main():
vowels = "aeiou"
ch = input("Enter a character: ")
if ch in vowels:
print(ch, "is a vowel")
else:
print(ch, "is a consonant")
main()
Example 2: Is the character ch a number (0-9)? import string
def main():
ch = input("Enter a character: ")
if ch in string.digits:
print(ch, "is a digit")
else:
print(ch, "is not a digit")
main()
3 Sample Output
Here are a few sample runs of the program.
>>> main()
Welcome to the password creator!
Your password must:
Be at least 8 characters in length
Contain at least 1 lowercase and 1 uppercase letter
Contain at least 1 special character (!@#$%&*)
Contain at least 1 number (0-9)
Please select a password: hK91@
hK91@ is not a valid password! 2
>>> main()
Welcome to the password creator!
Your password must:
Be at least 8 characters in length
Contain at least 1 lowercase and 1 uppercase letter
Contain at least 1 special character (!@#$%&*)
Contain at least 1 number (0-9)
Please select a password: hP394!@s
hP394!@s is a valid password!
>>> main()
Welcome to the password creator!
Your password must:
Be at least 8 characters in length
Contain at least 1 lowercase and 1 uppercase letter
Contain at least 1 special character (!@#$%&*)
Contain at least 1 number (0-9)
Please select a password: hello!09
hello!09 is not a valid password!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
