Jun-20-2019, 12:01 AM
name_expected='Max'
while True:
print( 'Who are you')
name = input()
if (name != name_expected):
continue
print (name_expected +' please enter your password' )
pd= input()
if (pd == '123'):
break
else:
print('password is not right, start from beginning of the loop') ----------> why can not reach here if give a wrong password.
print(' you are granted')
Please help with the above code. If enter a correct name but wrong password, I want to tell wrong password. Thanks!
while True:
print( 'Who are you')
name = input()
if (name != name_expected):
continue
print (name_expected +' please enter your password' )
pd= input()
if (pd == '123'):
break
else:
print('password is not right, start from beginning of the loop') ----------> why can not reach here if give a wrong password.
print(' you are granted')
Please help with the above code. If enter a correct name but wrong password, I want to tell wrong password. Thanks!
name_expected='Max' while True: print( 'who are you') name = input() if (name != name_expected): continue print (name_expected +' please enter your password' ) pd= input() if (pd == '123'): break else: print('password is not right, start from beginning') # why can not reach here if wrong password print(' you are granted')Please help with the above code. If I enter a correct name but wrong password, I want to print the else statement above mentioning a wrong password. Thanks!