usernames = ['admin', 'user']
def is_valid():
username = input('Username')
password = input('Password')
if username in usernames:
if username == 'user':
if password == 'qweasd':
print('True')
else:
print('False')
elif username == 'admin':
print('True')
else:
print('False')
else:
print('False')
is_valid()
Should work. If you need to tweak it, it is written intuitively.