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
If an interest inventory reveals that you are highly interested in solitary, introverted work, what might be the best type of ca
Deffense [45]
A writer maybe, because you can work by yourself, even at home.
6 0
2 years ago
Read 2 more answers
What are the programming concepts (within or outside the scope of IT210) that you would like to strengthen and delve into furthe
marin [14]

Answer:

The description for the given question is described in the explanation section below.

Explanation:

I would like to reinforce in advanced or complex concepts such as documents as well as channels, internet programming, multi-threading, after that last lesson.

  • I am interested in learning web development to develop applications or software. I would also like to explore those concepts by using open source tools.
  • Course concepts will have to develop models for handling.
  • No there is no subject matter or definition you provide further clarity for.
  • I'm interested in studying java as well as web development in comparison to C++ so I can use it in my contract work.
4 0
2 years ago
Please help me and solution in c language​
salantis [7]
Ummmm the solution is ummm brb
3 0
2 years ago
Global visibility is: Group of answer choices A visibility type where an object A has a semi-permanent reference to another obje
polet [3.4K]

Answer:

the visibility persists as long as both A and B exist.

Explanation:

Global visibility basically means that the visibility persists as long as both A and B exist. In programming global visibility signifies that the variable/data in question is visible from any context of the code. Meaning that it can be accessed and manipulated from any part of the code, even from within a function or another document. This makes it very easy to use and structure accordingly.

5 0
2 years ago
Who is in the age range of 13-15 and wants to join a mine craft smp?
Ratling [72]

Answer: Wow that's really cool!

3 0
2 years ago
Other questions:
  • The purpose of a capacitor unit in a vacuum cleaner is to
    12·1 answer
  • Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A
    5·1 answer
  • What does it mean to say that two variables are negatively correlated?
    6·1 answer
  • list the six external parts or "peripherals" of a computer system and identify which are output and which are input devices.
    15·1 answer
  • Ryan is working on a document with many secotions. For each section,he wantes to have the title bolded,underlined,an blue. Which
    9·2 answers
  • Adobe reader is a type of​
    14·2 answers
  • Betty set up an account on a popular social networking website. she wants to know whether the privacy policy is effective for he
    14·1 answer
  • Project manager Erica is discussing with her team to prepare a document to describe the deliverables and goals of a software pro
    13·1 answer
  • Karin realized that a song takes up a lot more space on her computer than the lyrics of the song typed out in ms word document .
    12·1 answer
  • The Advanced Properties sheet enables you to add which of the following?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!