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
Which of these is a historic real-world simulation game?
harkovskaia [24]

Answer:

B. Archery

Explanation:

the art, practice, or skill of shooting with bow and arrow

7 0
2 years ago
Jose has 3/5 kilogram of peppermints and 2/3 kilogram of candy canes. How many kilograms of candy does he have?
yarga [219]

Answer:

\frac{19}{15}\\

≅ 1.267

Explanation:

\frac{3}{5} +\frac{2}{3} \\\\= \frac{9}{15} + \frac{10}{15} \\\\= \frac{9+10}{15} \\\\= \frac{19}{15} \\\\= 1.267

6 0
2 years ago
Smartphones combine the features of which two types of devices?
tankabanditka [31]
Idunno if you got the answer to this question or if I'm too late, feel free to message me if I'm not!
6 0
3 years ago
Read 2 more answers
Review how to write a for loop by choosing the output of this short program.
Natalija [7]

This for loop will output:

0

2

4

The range(3) is all the integers between 0 inclusive and 3 exclusive. 0, 1, 2.

Every iterations through the for loop, we multiply the value of each number by 2 and print it to the console.

0 * 2 = 0

1 * 2 = 2

2 * 2 = 4

I hope this helps.

5 0
3 years ago
Read 2 more answers
_____ is human thinking and problem-solving by a machine, including learning, reasoning, and self-correction.
Delvig [45]
Yea, artificial intelligence :/
4 0
2 years ago
Other questions:
  • At what point is an idea protected by copyright?
    7·2 answers
  • . SQL is a(n) _____ language.
    8·1 answer
  • Explain why regular system cleanup is vital to ensuring the operating system runs efficiently.
    8·1 answer
  • Which application is a digital version of a manual typewriter? A. Database B. Presentation C. Spreadsheet D. Word processor
    8·2 answers
  • Interruption attacks are also called ___ attacks:
    8·1 answer
  • 16 to 19 year old drivers are how many more times likely to crash? 1.7,2.7,0.7 ,3.7
    12·2 answers
  • How should I do it Please code for Java
    15·1 answer
  • State the functions of all the parts of the computer​
    14·1 answer
  • What could have made you redesign your plan? Select 3 options.
    6·1 answer
  • Anyone wanna join my giggl?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!