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
Which of the following are true if you pay only the minimun amount each month towards your credit card bill? You will be charged
torisob [31]

Both A and B are true. Check out this link: https://www.nerdwallet.com/blog/credit-cards/minimum-payment-credit-card/

I hope this helps!

6 0
3 years ago
When you start to type =av, what feature displays a list of functions and defined names?
MAXImum [283]
The feature displays a list of functions and defined name, but after you start to type = av and it will begin typing an formula. Formula AutoComplete is the defined name will come up in the screen. Formula AutoComplete is also called the word completion it is a feature that predicts the remaining part of the word a user is typing.
3 0
4 years ago
Match the job roles with their appropriate qualifications
UNO [17]
Knowledge...- software QA engineer
Master’s...- business analyst
course...- network and computer admin
training...- multimedia artist
3 0
4 years ago
Primary purpose of ms Excel​
aleksandr82 [10.1K]
MS Excel is a spreadsheet programme developed by Microsoft in 1985, with the sole purpose of helping businesses compile all their financial data, yearly credit, and yearly debit sheets. Fast forward to the future after 31 years, it is now the most commonly used program for creating graphs and pivot tables.
8 0
3 years ago
c++ Write a for loop that computes the following sum: 5+10+15+20+...+485+490+495+500. The sum should be placed in a variable sum
ElenaW [278]

Answer:

#include <iostream>

#include <cstdlib>

 

using namespace std;

 

int main(){

 

 

   int sum=0, num=5;   //variables declaration and inicialization

 

   while (sum<500){   //conditioning to do the sum up to 500

   sum=sum+num;     //actually sum process

   cout << "The value is: "<<sum;   //show the result in screen

   };

   return 0;

}

5 0
4 years ago
Other questions:
  • Describe the "Mister Splashy Pants" campaign. How did it start? What happened?
    7·2 answers
  • Why might location be important when searching for a job?
    10·2 answers
  • For most applications, saving sound files at the _____ bit resolution provides a good balance of sound quality and file size.
    15·2 answers
  • If i were to give you free points woulld you take them?
    14·2 answers
  • When you expand the virtual size of a game, what do you create?
    7·1 answer
  • You've adjusted your bicycle seat so it's centimeters from the ground how high should your handlebars be
    10·2 answers
  • Which graphic file format would you choose if you needed to make an animated graphic for a website?
    5·1 answer
  • Explain with examples what is software​
    6·1 answer
  • How can you prevent someone with access to a mobile phone from circumventing access controls for the entire device
    5·1 answer
  • Objective a right turn true or false?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!