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
Svetlanka [38]
3 years ago
12

Some Web sites impose certain rules for passwords. Write a function that checkswhether a string is a valid password. Suppose the

password rules are as follows:A password must have at least eight characters.A password must consist of only letters and digits.A password must contain at least two digits.Write a program that prompts the user to enter a password and displays validpassword if the rules are followed or invalid password otherwise.
Computers and Technology
1 answer:
Levart [38]3 years ago
6 0

Answer:

def check_password(pwd):

   c=0

   d=0

   for i in pwd:

       if (i>='a' and i<='z') or (i>='A' and i<='Z'):

           c+=1

       elif i>='0' and i<='9':

           d+=1

           c+=1

   if len(pwd)==c and d>=2 and len(pwd)>=8:

       print("valid password")

   else:

       print("Invalid password")

 

ps=input("Enter password for checking : ")

check_password(ps)

Explanation:

  • Loop through the password and check if it contains any alphabet.
  • Increment the counter if it contains any alphabet.
  • If it contains a number, increment both c and d variables.
  • Finally display the relevant message.
You might be interested in
System software is software that allows users to do things like create text documents, play games, listen to music or web browse
hoa [83]

Answer:

False

Explanation:

System software is the collection of programs that controls and manage the operation of a computer.

5 0
3 years ago
Which of the following is the correct binary representation of the number 2?
dusya [7]

Answer:

10

Explanation:

To convert decimal to binary, you just count like normal, but instead of regrouping when adding 1 when you reach 9, you regroup when you reach 1.

in this case, you would count like this:

0

1

10

7 0
3 years ago
Fungsi radio adalah..?
malfutka [58]

Answer:

lebih lanjut bahwa radio mempunyai fungsi sebagaimana media- media lain yaitu memberikan informasi/to inform, memberikan pendidikan/to educate, memberikan hiburan/to intertain, fungsi memengaruhi/to influence, dan fungsi pengawasan to control.

<h2>translate;</h2>

Furthermore, radio has a function like other media, namely to provide information/to inform, provide education/to educate, provide entertainment/to intertain, function to influence/to influence, and control function to contact.

Explanation:

8 0
3 years ago
To move an icon, you right-click it and select “Pin to start menu.” True False
tester [92]

"To move an icon, you right-click it and select “Pin to start menu.” True False"

False

4 0
3 years ago
Read 2 more answers
Power consumption of computers is an important issue, and the vast majority of computers can be replaced by their low-power coun
joja [24]

Answer:

Solution is attached in pictures.

Explanation:

3 0
3 years ago
Other questions:
  • Choose the word that best completes this sentence. Caught-in and caught-between injuries result from a person being squeezed, ca
    6·2 answers
  • Make a ladtract class that has 2 fields, one for the tractor's length and one for the width. The class should have a method that
    7·1 answer
  • N a MenuStrip, if you create each main menu item with a(n) ____ in front of a unique letter, then the user can press Alt and the
    5·1 answer
  • Write a static method named anglePairs that accepts three angles (integers), measured in degrees, as parameters and returns whet
    10·1 answer
  • The graph of a function f x is shown below what is the domain of f x​
    15·1 answer
  • Marta, an art director, wants to give feedback to her graphic designer on his logo design. To be effective her feedback should b
    15·2 answers
  • I keep getting this error: postfix.cpp: In function ‘double RPN_evaluation(std::string)’: postfix.cpp:42:26: error: cannot conve
    7·1 answer
  • Write a program that asks the user to enter a date in MM/DD/YYYY format that is typical for the US, the Philippines, Palau, Cana
    8·1 answer
  • What type of computer is used in ATM?
    11·2 answers
  • The most common clefs for high notes are what?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!