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
The transitions between slides in a presentation are one type of powerpoint ____.
slava [35]
The transitions between slides in a presentation are one of type of power point 
Animation.
Animation is a set of effects which can be applied to objects in power point  so that they will animate in the slideshow power point.motion paths allow objects to move around the slide show.
4 0
3 years ago
A keyboard would be considered _____. Select 2 options.
Digiron [165]

Answer:

What are the 2 options?

Explanation:

7 0
3 years ago
Read 2 more answers
The phone in your hand is a computer. So too is the machine that occupies a 100,000 square foot data center. Given their vast di
Dmitry [639]

Answer:

Well when you think about it they both do the same thing but they are diffirent, they have the same perpose but diffirent parts in them so, when you compair them the phone is smaller and slower, the bigger the computer the better it is depending on the amount of money spent on parts.

5 0
3 years ago
What are four different commands in Internet Explorer and identify their keyboard shortcuts
Zigmanuir [339]
<span>Ctrl + Q -  show all tabs
Ctrl + O - open a file
Ctrl + T - Open a New Tab
Ctrl + W -  close a tab

Hope This Helped <3
</span>
6 0
3 years ago
When resizing images or objects in a presentation, why should a user not utilize the sizing handles in the middle of the sides
Shalnov [3]

When resizing an image or an object in a presentation, a user should not utilize the sizing handles in the middle of the sides or the bottom of the image. There's nothing wrong with resizing this way.

There's nothing wrong with resizing this way

<u>Explanation:</u>

When the sizing handles in the middle of the sides are used, the image stretches out reflecting an increase in the width maintaining There's nothing wrong with resizing this way.

On the other hand, while using the sizing handles at the bottom, the image increases in height whilst maintaining the same width again disturbing the aspect ratio.

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the other name of the horizontal column graph?
    6·2 answers
  • Technician A says that the last step in the diagnostic process is to verify the problem. Technician B says that the second step
    12·1 answer
  • A block style business letter is
    14·1 answer
  • If I want to have an estimate of the number of people who visited my website, which metric should I use?
    5·2 answers
  • Object-oriented programs employ a group of techniques for handling errors called ________ handling.
    12·1 answer
  • How are engineers are related to technology
    13·1 answer
  • How designers have created products from waste materials?
    7·1 answer
  • Write a program that deliberately contains an endless or infinite while loop. The loop should generate multiplication questions
    13·1 answer
  • How do you close a file?
    12·2 answers
  • Bluetooth is the popular name for the 802. 15 wireless networking standard, which is useful for creating small __________.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!