Question

In: Computer Science

Password check, lab2pr1.py Many websites these days require that a password is between 8 and 20...

Password check, lab2pr1.py Many websites these days require that a password
is between 8 and 20 characters, doesn’t have spaces, and satisfies the following
conditions: contain at least one uppercase letter, contain at least lowercase letter,
contain at least one number, and contain at least one special symbol character
(”!?,.;:$# &”). Write a program that keeps asking the user to enter the password
until they enter one that satisfies the requirements.
Please enter a password:
@Tulane2020
Please enter a password:
#Tulane2020
Password accepted

use python

Solutions

Expert Solution

import re
#checks for uppercase
def upperCheck(password):
return any(x.isupper() for x in password)
#checks for lowercase
def lowerCheck(password):
return any(x.islower() for x in password)
#checks for digit
def digitCheck(password):
return any(x.isdigit() for x in password)
#checks for special char
def specialCheck(password):
regex = re.compile('[!?,.;:$#&]')
return regex.search(password) != None

while(True):
password=input("Enter password: ")
if upperCheck(password) and lowerCheck(password) and digitCheck(password) and specialCheck(password) and len(password)>= 8 and len(password)<=20:
print(password," is valid password")
break
else:
print(password,"is invalid password.Try again..")
  

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me


Related Solutions

I need a basic and simple Java code for this exercise: (Check password) Some websites impose...
I need a basic and simple Java code for this exercise: (Check password) Some websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. Suppose the password rules are as follows: ■ A password must have at least eight characters. A character is alpha or digit. ■ A password consists of only letters and digits. No other symbols. ■ A password must contain at least two digits. Write a program that prompts...
PYTHON Exercise 3. Password locker. 1. You probably have accounts on many different websites. It’s a...
PYTHON Exercise 3. Password locker. 1. You probably have accounts on many different websites. It’s a bad habit to use the same password for each of them because if any of those sites has a security breach, the hackers will learn the password to all of your other accounts. Develop a simple password manager software on your computer where you write the account name (blog, facebook, instagram, etc) as an argument and the password is copied to the clipboard. Then...
Using a UTF-8 Unicode implementation, how many bytes would it require to store the string "Dog!"
Using a UTF-8 Unicode implementation, how many bytes would it require to store the string "Dog!"
The 6h 20 min between low and high tide is caused by what? The 7 days...
The 6h 20 min between low and high tide is caused by what? The 7 days between very large to mild CHANGES in tides is caused by what? We see very large tide changes when the moon is in what two phases?              We see mild tide changes when the moon is in what two phases? The unlit side of the moon ought to be totally black and be unseen in any phase. However, often it can be dimly seen. Why?...
8. The following Regression function has been developed to check the relationship between Y-‘Risk of a...
8. The following Regression function has been developed to check the relationship between Y-‘Risk of a stroke’ and some other factors; X1- Age X2 –Pressure X3 –Smoker X4 -Age Press Consider the following Minitab output and answer the questions. Risk = - 123 + 1.51 Age + 0.448 Pressure + 8.87 Smoker - 0.00276 AgePress Predictor Coef SE Coef T P Constant -123.16 56.94 -2.16 0.047 Age 1.5130 0.5980 2.53 0.021 Pressure 0.4483 0.1291 3.47 0.004 Smoker 8.866 3.074 2.88...
8. A swimming pool is filled at a rate that is uniformly distributed between 20 and...
8. A swimming pool is filled at a rate that is uniformly distributed between 20 and 26.3 gallons per minute. a. Draw a sketch that illustrates this particular situation. Please label all relevant information for this probability density function. (5 pts) b. What is the probability that the filling rate at any one time is between 21.3 and 24.6 gallons per minute? (6 pts) c. What is the median rate at which this swimming pool is filled? (4 pts) 8....
Determine correlation coefficient and determination coefficient. quarantine days Covid-19 deaths 2 25 5 20 8 19...
Determine correlation coefficient and determination coefficient. quarantine days Covid-19 deaths 2 25 5 20 8 19 10 17 13 13 15 10 18 10 20 8 25 5 30 5 Correlation coefficient (r) Determination coefficient (r2)
A and B together can complete a piece of work in 20 days. B and C together can complete in 30 days. If A is twice as good a workman as C, then in how many days will B alone can complete the same work?
A and B together can complete a piece of work in 20 days. B and C together can complete in 30 days. If A is twice as good a workman as C, then in how many days will B alone can complete the same work?
We flip a fair coin 20 times. Find the probability that we obtain between 8 and...
We flip a fair coin 20 times. Find the probability that we obtain between 8 and 17 heads, inclusively. Show work and please explain to someone that hardly understands statistics!
8. Drug molecules moving between “compartments” move at different equilibrium constants. There are many factors that...
8. Drug molecules moving between “compartments” move at different equilibrium constants. There are many factors that affect the rate at which drug molecules move: name three of these factors & explain in 1 sentence each why it would affect distribution.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT