1
Opa, then, I need to inform to those who are using the program, if you already have any user registered with this name and inform the age of the same contains in the list that must be registered before the verification, however I’m having some difficulties with this, especially in the matter of fetching this data and printing, follows code.
opções1 = ("1 - Cadastrar novo usuário")
opções2 = ("2 - Listar usuários cadastrados")
opções3 = ("3 - Sair do sistema")
opções4 = ("4 - Busca de usuarios")
escolha = 0
CadastroUsuario = 0
Usuarios = list()
Idade = list()
separador= list()
lista = ""
valor = 0
while escolha != 4:
print(opções)
print(opções1)
print(opções2)
print(opções3)
print(opções4)
escolha = int(input("Qual opção deseja fazer? "))
print(escolha)
if escolha == 1:
CadastroUsuario = int(input("Deseja cadastrar quantas pessoas? "))
if CadastroUsuario <= 0:
print('\033[31mValor Inválido! Digite inteiros maiores que "0"!\033[m')
for c in range(1, CadastroUsuario + 1):
Usuarios.append(input(f"Digite o nome do {c} Usuario: "))
Idade.append(input(f"Digite a idade do {c} Usuario: "))
separador.append(print(f"\033[1;34m=-==-==-==-= FIM DE CADASTRO DO USUARIO {c}!! =-==-==-==-=\033[m"))
print(f'{c}')
if escolha == 2:
if CadastroUsuario > 0:
print(f'0s usuários são: \033[32m{Usuarios}\033[m')
print(f'As idades são: \033[32m{Idade}\033[m')
elif CadastroUsuario == 0:
print('=-=' * 10)
print(f"\033[1;34mNão temos nenhum usuario cadastrado, para cadastrar um usuário, digite 1!!\033[m")
if escolha == 3:
print("Finalizando...")
elif escolha == 4:
procurar = input("Digite quem você procura: ")
print('Usuario cadastrado? {}'.format(procurar in Usuarios))
def search (usuarios, valor):
return [(Usuarios.index(x), x.index(valor)) for x in Usuarios if valor in x]
for i in Usuarios:
local = Usuarios.index(i)
for b in i:
if b == procurar:
print("teste: [{}]".format(local))
break
print("Quem você procura:",lista[local])
elif escolha > 4:
print(f"\033[1;31mOpção inválida. Tente novamente\033[m")
elif escolha <= 0:
print(f"\033[1;31mOpção inválida. Tente novamente\033[m")
print('=-=' * 10)
print(f"\033[1;32mVocê saiu do programa com exito!! volte sempre!\033[m") ```