/*
* ----------Valid PassWord----------
* PassWord must contain:
* At least SIX characters
* At least ONE character Caps lock
* At least ONE character lowerCase
* At least ONE number
* And Can not contain SPACE
*/let password ="Doctor_Who_98"var contain_space =0var contain_latters_lowerCase =0var contain_latters_capsLock =0var contain_number =0var number_character =0// up all the counters zeroedlet latters_lowerCase ="abcdefghijklmnopqrstyvxzy"let latters_capsLock ="ABCDEFGHIJKLMNOPQRSTUVXZY"let numbers ="0123456789"for check_password in password {//will scroll through all the characters of the password
number_character +=1//Count the amount of characterif check_password ==" "{
contain_space +=1//check if there is any space}for check_latters_lowerCase in latters_lowerCase {if check_password == check_latters_lowerCase {
contain_latters_lowerCase +=1//Count the lowercase letters}}for check_latters_capsLock in latters_capsLock {if check_password == check_latters_capsLock {
contain_latters_capsLock +=1//Count the capslock letters}}for check_numbers in numbers {if check_password == check_numbers {
contain_number +=1//Count the number of numbers}}}if contain_space ==0&& contain_number >0&& contain_latters_lowerCase >0&& contain_latters_capsLock >0&& number_character >=6{print("Password OK")}else{print("Invalid Password")}// Twitter: @thiagoandreqi// Instagram: alfacexburger
Pergunta
Thiago André Cardoso
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.