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
VARVARA [1.3K]
3 years ago
6

Write a function named enterNewPassword. This function takes no parameters. It prompts the user to enter a password until the en

tered password has between 8 and 15 characters, including at least one digit. Tell the user whenever a password fails one or both of these tests. The function enterNewPasswordshould return the new password.
Computers and Technology
1 answer:
zloy xaker [14]3 years ago
4 0

Answer:

def enterNewPassword():

 while True:

   password = input("Enter password: ")

   has_digit = False

   for i in password:

     if i.isdigit():

       has_digit = True

       break

   

   if not has_digit or (len(password) < 8 or len(password) > 15):

     if len(password) < 8 or len(password) > 15:

       print("The password length must be between 8 and 15!")

     if not has_digit:

       print("The password must include at least one digit!")

   else:

     return password

print(enterNewPassword())

Explanation:

*The code is in Python.

Create a function named enterNewPassword that takes no parameter

Create an indefinite while loop. Inside the loop, ask the user to enter the password. Initialize the has_digit as False, this will be used to check if password contains a digit or not. Create a for loop, that that iterates through the password, if one character is digit, set the has_digit as True and stop the loop (Use isdigit() to check if the character is digit or not).

After the for loop, check if has_digit is false or the length of the password is not between 8 and 15. If the length of the password is not between 8 and 15, print the error. If has_digit is false, again print the error.

Otherwise, password met the requirements and return the password

Call the enterNewPassword() function and print the result

You might be interested in
How would a programming language that allows programs to run on any operating system be classified?
Illusion [34]
Cross-platform.





--------------------
3 0
3 years ago
Which operating system might cause the desktop background to change unexpectedly?
Hunter-Best [27]
I used computers for 3 years now and i think its B
4 0
2 years ago
Write a Java method to delete a record from a B-tree of order n.
max2010maxim [7]

Answer:

Deleting a record on a B-tree consists of three main events:

- Searching the node where the key to be deleted exists

- Deleting the key

- Balancing the tree if required

Explanation:

q = NULL;

   p = tree;

   while (p) {

       i = nodesearch(p, key);

       q = p;

       if (i < used(p) -1 && key == k(p,i)) {

           found = TRUE;

           position = i;

           break;

       }

       p = son(p,i);

   }

   if (!found)

   else if (subtree(p)) {

         if (used(p) > ((n-1)/2)+1)

         delkey (p, position, key);

       else {

           replace (p, position, fsucc(p));

           p0 r1 p1 r2 p2 r3 ……. pn-1 rn-1 pn

           q = &fsucc(p);

           qpos = index of fsucc;

           if (used(rbrother(p)) > ((n-1)/2)+1)

               replace (q, qpos, sonsucc(q));

           else

               while (q && used(q) < (n-1)/2) {

                   concatenate(q, brother(q));

                   q = father(q);

               }

       }

   }

   else

   delkey(p, position, key);

}

6 0
3 years ago
How to code for a database?​
olganol [36]

Answer: <em><u> How to code for a database?​ A database is an organized collection of data, generally stored and accessed electronically from a computer system. Where databases are more complex they are often developed using formal design and modeling techniques. </u></em>

WWW. Wikipedia.com

Explanation: When creating a database first you need to make a software program then you need to start planing on what to do ...

{ A database management program (DBMS) is a software package design designed to manipulate, define, retrieve, and manage data in database.

A DBMS generally manipulates the data itself, the the data format, field names, record structure and file structure.}

<h3><u><em>HoPe ThIs HeLpS YoU!!</em></u></h3>

<u><em /></u>

7 0
2 years ago
charles, a security analyst, needs to check his network for vulnerabilities. he wants a scan that interacts with network nodes a
finlep [7]

Charles, a security analyst, needs to check his network for vulnerabilities. he wants a scan that interacts with network nodes and repairs security issues found. The kind of scanning that best describes Charles's requirements is: Active scanning.

<h3>Who is a Security Analyst?</h3>

A Security Analyst's responsibilities include the following:

Define, plan, execute, maintain, and improve security measures, policies, and controls. Writing reports and offering insights on the effectiveness of current security policies, incident response plans, disaster recovery plans, and other security-related information

Active scanning is a scanning approach that involves scanning individual endpoints in an IT network in order to retrieve more specific information.

Learn more about Security Analysts:
brainly.com/question/16354463
#SPJ1

6 0
1 year ago
Other questions:
  • Explain the nature of documents that can be suitable for mergin
    12·1 answer
  • What are the design concepts and assumptions behind a class, an object and the relationship between them? What are the roles met
    9·1 answer
  • 1. You have recently been hired by a leading firm, which provides information management solutions to large corporations. As a n
    12·2 answers
  • PLEASE HELP, True or False: The term whitespace speaks to the design of a website
    8·2 answers
  • What has information technology made piracy possible?
    14·1 answer
  • Is the jane austen pride and prejudie a primary source
    6·1 answer
  • What is the text that is entered into a cell used to identify the purpose of the worksheet, columns, and rows? a. date and time
    14·1 answer
  • Question #3
    12·1 answer
  • 1. Software that is designed to intentionally cause harm to a device, server, or network is A. outware B.loggerware C.
    12·1 answer
  • Change the following sentences using 'used to
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!