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
Sorry, I cant tell you, you need to know
Luba_88 [7]

Answer:

answer a

Explanation:

sorry it’s for the points

7 0
2 years ago
Read 2 more answers
Firestick optimizing system storage and applications
Nat2105 [25]

seach up this on goggle many great videos will pop up

Explanation:

<3

7 0
3 years ago
g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
timama [110]

Answer:

see explaination

Explanation:

MATLAB script:

% MATLAB script that calculates reciprocal Fibonacci constant Ψ

% Initial Values

a0 = 1;

a1 = 1;

% Looping variable

i = 2;

% Reading n value from user

n = input(' Enter n value: ');

% Initializing sum

sum = (1/a0) + (1/a1);

% Loop till i reaches n value

while i <= n

% Finding term in Fibnocii series

a2 = a0 + a1;

% Accumulating Sum

sum = sum + (1/a2);

% Updating previous terms

a0 = a1;

a1 = a2;

% Incrementing loop variable

i = i + 1;

endwhile

% Printing result

printf("\n Reciprocol Fibnocii Constant: %f \n", sum);

See attachment for sample output

5 0
3 years ago
PV = 11,000 AC = 6000 CV = 4,000. What is SV? What does this calculation tell you?
pogonyaev

Answer:

I don't see an SV in the examples.. I suspect these are the name plate numbers off of a transformer... but.. more context would really help

Explanation:

8 0
4 years ago
A _______________ is a particular type of network that uses circuits that run over the Internet but that appears to the user to
ArbitrLikvidat [17]

Answer:

A virtual privte network is a particular type of network that uses circuits that run over the Internet but that appears to the user to be a private network.

5 0
2 years ago
Other questions:
  • What kind of testing is basically checking whether a game or feature works as expected by the developers?
    10·1 answer
  • Which Google Analytics visualization compares report data to the website average?A. Pivot viewB. Comparison viewC. Performance v
    8·1 answer
  • Refer to the exhibit, a technician applies the configuration in the exhibit to an unconfigured router. To verify the configurati
    13·1 answer
  • Which piece of computer hardware was revised to run hypervisors natively?
    12·2 answers
  • When entering data in Access if the data is entered using an Access form, that data is stored in a table or tables. TRUE FALSE
    12·1 answer
  • Which of the following popular presentation software items do you have to purchase in order to use?
    11·2 answers
  • Which of the following defines a computer program?
    14·1 answer
  • This provides an easy method for workers to use their computers. FAT FAT RAM RAM DOS DOS GUI
    12·1 answer
  • Write a java code to print Multiplication Table Till 20
    14·2 answers
  • What's the commission payout for auto bill pay if sold with a ga?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!