1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MrRissso [65]
3 years ago
8

In this exercise, you are asking the user to set a alpha numeric password for any website. Put some conditions.

Computers and Technology
1 answer:
AveGali [126]3 years ago
7 0

Answer:

The program in Python is as follows:

print("Create your password which must have these.\nMust be 8 characters long.\nAt least one uppercase letter.\nAt least one number.")

pwd = input("Enter your password: ")

chkLength = 0; chkUpper = 0; chkLower = 0; chkDigit = 0

if len(pwd) == 8:

   chkLength = 1

if (any(x.isupper() for x in pwd)):

   chkUpper = 1

if any(y.islower() for y in pwd):

   chkLower = 1

if any(z.isdigit() for z in pwd):

   chkDigit = 1

if chkLength == 1 and chkUpper == 1 and chkLower == 1 and chkDigit == 1:

   print("You have set the correct password.")

else:

   print("Your password doesn't meet the criteria.")

   if chkLength == 0:

       print("It's not 8 characters long correct size.")

   if chkDigit == 0:

       print("Digit is missing.")

   if chkLower == 0:

       print("Lowercase is missing.")

   if chkUpper == 0:

       print("Uppercase is missing.")

Explanation:

This prints the instruction

print("Create your password which must have these.\nMust be 8 characters long.\nAt least one uppercase letter.\nAt least one number.")

This prompts the user for password

pwd = input("Enter your password: ")

This initializes check variables to 0 (0 - false)

chkLength = 0; chkUpper = 0; chkLower = 0; chkDigit = 0

If password length is 8

if len(pwd) == 8:

Set check variable of length to 1 (1 - true)

   chkLength = 1

If password has uppercase

if (any(x.isupper() for x in pwd)):

Set check variable of uppercase to 1

   chkUpper = 1

If password has lowercase

if any(y.islower() for y in pwd):

Set check variable of lowercase to 1

   chkLower = 1

If password has digit

if any(z.isdigit() for z in pwd):

Set check variable of digits to 1

   chkDigit = 1

If all check variables is 1, then the password is correct

<em>if chkLength == 1 and chkUpper == 1 and chkLower == 1 and chkDigit == 1: </em>

<em>    print("You have set the correct password.") </em>

If otherwise,

else:

The password is incorrect

   print("Your password doesn't meet the criteria.")

The following prints the corresponding criteria that is not met, depending on the value of its check variable

 <em>  if chkLength == 0: </em>

<em>        print("It's not 8 characters long correct size.") </em>

<em>    if chkDigit == 0: </em>

<em>        print("Digit is missing.") </em>

<em>    if chkLower == 0: </em>

<em>        print("Lowercase is missing.") </em>

<em>    if chkUpper == 0: </em>

<em>        print("Uppercase is missing.")</em>

You might be interested in
1. Why does a computer have different types of ports?
iren2701 [21]

Answer:

Computer ports are classified into two types based on the protocols used. A protocol is a set of rules and standards to be followed during data transfer and communication. Usually, data is transmitted in a particular pattern.

Explanation:

3 0
2 years ago
Read 2 more answers
Technician A says that if you add pre-lube to a sealing lip of an axle seal, it will cause the seal to leak causing the bearings
Verizon [17]
Technician B because you put grease on the sealing lip
7 0
3 years ago
Who is he can anyone help me​
34kurt
This person is Elon Musk, the owner of Tesla :)
5 0
2 years ago
Read 2 more answers
How do you create a logo on Adobe illustrator
artcher [175]
Idk idk idk idk if dub
7 0
3 years ago
How do you fix peer answer bad gateway 502. Please help
kondaur [170]

Answer:

Reload the page.

Look for server connectivity issues.

Check for any DNS changes.

Sift through your logs.

Fix faulty firewall configurations.

Comb through your website's code to find bugs.

Contact your host.

Explanation:

7 0
3 years ago
Other questions:
  • The following is true about SPAM ________.
    9·1 answer
  • Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
    5·2 answers
  • If you are viewing a webpage with customized or regenerated content, such as updated stock quotes, what type of webpage are you
    14·1 answer
  • Consider the following sequence of items 10, 36, 25, 54, 37, 12, 75, 68, 42, 86, 72, 90. Insert these items in the order above,
    5·1 answer
  • Which date formats are allowed in Excel for February 14, 2018? Check all that apply.
    15·2 answers
  • What are the two ways that assets are
    5·1 answer
  • This is in government
    15·1 answer
  • ________ is used by text recognition software to convert typed, printed, or handwritten text into the computer-based characters
    15·1 answer
  • ________ is a computer-based network that triggers actions by sensing changes in the real or digital world.
    15·2 answers
  • The capability of moving a completed programming solution easily from one type of computer to another is known as ________. Grou
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!