Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desafio_12 #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Desafio_12 #12

wants to merge 2 commits into from

Conversation

SaLucas-py
Copy link

{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "increasing-detection",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Digite sua senha: 1234\n",
"Senha inválida - Numero de caracteres inválidos\n"
]
}
],
"source": [
"import re\n",
"def validator(senha):\n",
" min_len = 6\n",
" max_len = 16\n",
" maiuscula = 1\n",
" minuscula = 1\n",
" min_numero = 1\n",
" especial = 1\n",
" \n",
"\n",
" if len(senha or ()) < min_len and len(senha or() > max_len):\n",
" print('Senha inválida - Numero de caracteres inválidos')\n",
"\n",
" elif len(re.findall(r"[A-Z]", senha)) < maiuscula:\n",
" print('Senha inválida - Número de letras maiusculas inválidas')\n",
" \n",
" elif len(re.findall(r"[a-z]", senha)) < minuscula:\n",
" print('Senha inválida - Número de letras minusculas inválidas')\n",
" elif len(re.findall(r"[0-9]", senha)) < min_numero:\n",
" print('Senha inválida - Quantidade de algarismos inválidos')\n",
" elif len(re.findall(r"[$#@]", senha)) < especial:\n",
" print('Senha inválida - Quantidade de caracteres especiais inválidos')\n",
" else: \n",
" print('Senha correta!')\n",
"\n",
"\n",
"#programa principal\n",
"senha = input('Digite sua senha: ')\n",
"validando = validator(senha)\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "armed-blackjack",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Digite sua senha: Qw#1234\n",
"Senha correta!\n"
]
}
],
"source": [
"import re\n",
"#Função pedida\n",
"def validator(senha):\n",
" min_len = 6\n",
" max_len = 16\n",
" maiuscula = 1\n",
" minuscula = 1\n",
" min_numero = 1\n",
" especial = 1\n",
" \n",
"\n",
" if len(senha or ()) < min_len and len(senha or() > max_len):\n",
" print('Senha inválida - Numero de caracteres inválidos')\n",
"\n",
" elif len(re.findall(r"[A-Z]", senha)) < maiuscula:\n",
" print('Senha inválida - Número de letras maiusculas inválidas')\n",
" \n",
" elif len(re.findall(r"[a-z]", senha)) < minuscula:\n",
" print('Senha inválida - Número de letras minusculas inválidas')\n",
" elif len(re.findall(r"[0-9]", senha)) < min_numero:\n",
" print('Senha inválida - Quantidade de algarismos inválidos')\n",
" elif len(re.findall(r"[$#@]", senha)) < especial:\n",
" print('Senha inválida - Quantidade de caracteres especiais inválidos')\n",
" else: \n",
" print('Senha correta!')\n",
"\n",
"\n",
"#programa principal\n",
"senha = input('Digite sua senha: ')\n",
"validando = validator(senha)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "another-force",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant