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
On line two, you take a string, word, as input. Then, using that string...
Solnce55 [7]

Answer:

7

Explanation:

This one obtains results that the others in particular do not have, whether it is even one more word or another initial sentence

8 0
2 years ago
Taylor develops a prototype for a new smartphone. It only includes code, a way to process the input, a memory card, and a microp
marysya [2.9K]

Answer:

i would say C.output

Explanation:

the program would be the code, the input would be the input, and the memory card would be the memory leaving the output as the only thing forgotten.

6 0
3 years ago
Read 2 more answers
X = 10<br> y = 20<br> x &gt; У<br> print("if statement")<br> print("else statement")
Ksenya-84 [330]

Answer:

n

Explanation:

n

5 0
3 years ago
Fill in the blank to complete the sentence. -------------------- is used to store and process data over the Internet using compu
Trava [24]

Answer:cloud computing

Explanation:

6 0
2 years ago
What is the name of html command? ​
Makovka662 [10]

Here are some.

  • <html></html> This is the root element tag. ...
  • <head></head> ...
  • <title></title> ...
  • <body></body> ...
  • <h1></h1> ...
  • <p></p> ...
  • <a></a> ...
  • <img></img>
<h2>hope it helps.</h2><h2>stay safe healthy and happy....</h2>
3 0
2 years ago
Other questions:
  • I. Given the following Java code fragment, what is output? int a, b; String c, d, e; String x = new String("I LOVE"); String y =
    14·1 answer
  • What are the factors that influence the selection of access control software and/ or hardware? Discuss all aspects of access con
    7·1 answer
  • Read the four detective reports and the combined affidavit and warrant for the M57 Patents case. Write a one- to two-page paper
    5·1 answer
  • As a computer science student, which career you will select and what do you predict about the future of that specific IT-Career.
    8·1 answer
  • All digital devices use software programs to function. Software <br> BLANK create these programs.
    14·1 answer
  • One of the main responsibilities employers have under OSHA is to:
    9·2 answers
  • Create the HTML code for this
    14·1 answer
  • What maintains data about various types of objects, events, people, and places?
    10·1 answer
  • Discuss new concepts that you have learned about Cisco Devices and how they will be helpful in the workplace.
    11·1 answer
  • Visual Basic: What are arrays, please give an example code.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!