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
What are some other features of sending attachments in Outlook 2016? Check all that apply.
Elis [28]

Answer:

the answer is a, b,d on edg.

Explanation:

8 0
2 years ago
Read 2 more answers
In general, use no more than _____ font types in a worksheet.
jek_recluse [69]
The answer is a.two
In general, use no more than two font types in a worksheet.
4 0
3 years ago
POINT AND BRAINLIEIST GIVE AWAY!!!
Sonbull [250]

Answer:

Hey whats up

Explanation:

Count me in chief! I love when fellow user give out mighty points

7 0
3 years ago
Read 2 more answers
In a print statement, you can set the __________ argument to a space or empty string to stop the output from advancing to a new
jeka94

In a print statement, you can set the End argument to a space or empty string to stop the output from advancing to a new line.

<h3>What is a Print statement?</h3>

A print "statement" is known to be a kind of statement that looks like a call to the make (print) or println process of the System.

Note that In a print statement, you can set the End argument to a space or empty string to stop the output from advancing to a new line so that it can work properly.

Learn more about  print statement from

brainly.com/question/25220385

#SJ1

6 0
2 years ago
Jenny wants to create an animated short video to add to her website. Which software will she use to create this animated video?
denis23 [38]
Adobe Spark or Adobe Premier.
6 0
3 years ago
Other questions:
  • The unique global address for a web page or other resource on the internet is called the ________.
    7·1 answer
  • Where to set up wireless network xbox one?
    5·1 answer
  • A user calls your help desk to report that the files on her USB stick do not have any permissions associated with them and there
    15·2 answers
  • Select the correct text in the passage. George is working as a lead team lead. Which statements correctly describes the skills t
    12·1 answer
  • A(n) ____ string contacts the data source and establishes a connection with the database using the Data Source Configuration Wiz
    5·1 answer
  • What are the disadvantages of using pointers?
    6·1 answer
  • A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
    8·1 answer
  • Help!!!
    8·1 answer
  • Alex has composed a layout with this Image for a magazine. Which rule of composition has Alex applied?
    14·1 answer
  • 15 _____ 3 = 0 Question 11 options: a) / b) % c) * d) //
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!