if passretry == 'yes' or 'Yes':
the above if statement is evaluated as: -
if (passretry == 'yes') or 'Yes':
Now, since 'Yes'
is evaluated to True
, so, your if
statement is always True
, and hence you always have to enter new password.
You need to change the condition to: -
if passretry in ('yes', 'Yes'):
likewise, the following elif
should be changed to: -
elif passretry in ('no', 'No'):