Oct-26-2020, 01:38 PM
(Oct-26-2020, 12:51 PM)GOTO10 Wrote:(Oct-26-2020, 12:43 PM)MahaEbrahim Wrote: the issue here is that the exception can not see the else conditions if the user exceeded the allowed numbers of Attempts which is 2.
Think about what happens after the user gets their second ValueError. You increment the variable z so that it is now equal to 2, then your while loop on line 5 starts over. Since the while condition is no longer True (z is no longer less than 2), the while loop is skipped and execution resumes at line 19.
I can see it now. I changed the else to if . and it worked.