I'm trying to do a username + password simulation in Python.
So far I have made a program that asks for username (admin is right answer) and password (secret is right answer) and if both is right it says welcome boss if one or both is wrong it says wrong password, but I would like for the program to demand an answer and not just let you pass an answer as blank space. I tried to do a def username_request():
and then put it again in the else:
section and by my logic if nothing is put into the input it should loop it again but it does not do this. Any explanations or examples of an actual working program (simple username/password) would be greatly appreciated!
print('Welcome')
print('Please enter username')
def username_request():
username = input()
if username:
print('Please enter password')
else:
print('You did not enter a username, please enter a username')
username_request()
password = input()
if username + password == 'admin' + 'secret':
print('Welcome Boss!')
else:
print('Wrong password')