Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
{
"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
}