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
Edhesive 4.8 question 3​
Alex777 [14]
How may I help u today sir
7 0
3 years ago
Users in a corporation currently authenticate with a username and password. A security administrator wishes to implement two-fac
Katen [24]

Answer:

Option (C) is the correct answer of this question.

Explanation:

Smart card is the security administrator wishes to implement two-factor authentication to improve security.Normally this data is affiliated with either meaning, information, or both, and will be stored and transmitted within the chip of the card.A smart card, usually a Chip Card type.

  • It is a flexible card that holds an integral computer chip that preserves and sends a signal data, either database or semiconductor form.
  • Used for controlling access to a resource.
  • Data authentication, encryption, cloud storage, and software processing can be established by smart cards.

Other options are incorrect.

4 0
3 years ago
¿por que hay peligros en internet?
puteri [66]

Answer:

Wait

it eases off.

Get home,

gathered,

very close and look up –

we find it’s all right.

Play:

they be.

For life,

but all vanished

picture faces –

matter: I do or don’t.

More,

something

out of hold

squeeze it tightly

my best,

my best life.

Opened,

something –

back at that moment –

all marchers

the room, the door, the front

rang through the outside

Explanation:

7 0
3 years ago
Write a program that encrypts and decrypts a string of characters. Use a char array for this, not the string class. The maximum
dem82 [27]

Answer:

C++ code for encryption is given below

Explanation:

#include <iostream>

using namespace std;

//functions to encrypt and decrypt

void encrypt(char str[]);

void decrypt(char str[]);

int main(){

char str[200];

bool done = false;

while(!done){

cout << "Enter a string (enter * to stop): ";

cin.getline(str, 200);

if(str[0] == '*' && str[1] == '\0')

done = true;

else{

encrypt(str);

cout << "Encrypted: " << str << endl;

decrypt(str);

cout << "Decrypted: " << str << endl;

}

cout << endl;

}

}

void encrypt(char str[]){

int i = 1;

for(int j = 0; str[j] != '\0'; j++){

str[j] += i;

i++;

if(i == 11)

i = 1;

}

}

void decrypt(char str[]){

int i = 1;

for(int j = 0; str[j] != '\0'; j++){

str[j] -= i;

i++;

if(i == 11)

i = 1;

}

}

3 0
3 years ago
A folder has been shared with other users and set to read-only. What does this mean for users?
In-s [12.5K]
Users is what people use on the computer.
Its means that other people get to only read your folder.
5 0
3 years ago
Read 2 more answers
Other questions:
  • After clicking the Start button on your computer screen desktop, what option would you then select to examine system components
    13·1 answer
  • i see tabs named mowed and Ramsey i tried shredding them and deleting them and ending all the processes but they start duplicati
    13·1 answer
  • After several configuration changes are made to a router, the copy running-configuration startup-configuration command is issued
    14·1 answer
  • Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
    15·2 answers
  • My internet works but my router won't let any devices connect to it unless you use a cat. 5 cable :\
    12·1 answer
  • Which of the following statements are true about the code shown below in the class named Quiz? (Select all that apply.)
    7·1 answer
  • Which of the following statements is FALSE?
    5·1 answer
  • Write a program that reads and unspecified number of integers, determines how many positive and negative values have been read,
    10·1 answer
  • What is the difference between encoding and decoding?
    9·1 answer
  • An embedded system describes computing technology that has been enclosed in protective shielding for security reasons. True or f
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!