8. your own while else


My code works but Please explain why I can't see my 'You lose' message.

8. Your own while / else

It's because your else statement is outside of the while funktion :wink:


if you have while/else, else only runs when loop condition becomes false

If you guess the correct, the loop breaks, else won't run. Which is what you want, given you don't want to inform the user they lost right after they won

if you don't guess the correct number of guesses you have, the loop condition will become false and you loose will be printed (just like it should)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.