+ 1

How to execute the functions{ acesso() and cadastro() } from whithin the 'while loop' block?

lista_de_usuarios = {} print ('BEM VINDO AO BCI') print("PARA CADASTRO PRESSIONE 1 E 2 PARA LOGIN") def acesso(): print ('Insira o seu usuário') user = input() print ('insira a sua palávra chave') password = input() if user in lista_de_usuarios: if lista_de_usuarios[user] == password: print ('ACESSO LIVRE') else: print ('A senha digitada está incorrecta') else: print('Este usuário não consta em nossa base de dados') #acesso() def cadastro(): print ('Insira o seu nome') nome = input() print ('insira a sua idade') idade = input() lista_de_usuarios[nome]=idade #cadastro() while True: opcao_1 = input() if opcao_1 == '': print ('NADA FOI SELECIONADO, ADEUS') break elif opcao_1 == 2: acesso() elif opcao_1 == 1: cadastro()

17th Mar 2020, 9:22 AM
Lamennais
2 odpowiedzi
+ 4
As all prompts and messages are non- english, it makes it a bit difficult to understand. But anyway, the calling of the functions are not done, because your first input to "opcao_1" is a string, but you compare it with an int. Modify your code like this: opcao_1 = int(input()) An other hint: it would be great if you could link your code here instead of copy paste it here.
17th Mar 2020, 10:42 AM
Lothar
Lothar - avatar
+ 2
I'm very appreciative of you taking the time to assist, It worked. Thank you
17th Mar 2020, 12:05 PM
Lamennais