Win or Lose
if input("play again? [Y/n]").lower() != "n":
It looks like it might be, but indentation is so important in Python, it's impossible to be sure without formatting.
Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area.
Or watch this video on code formatting.
Commonly I know if...else pair, but I didn't come across with while...else, it seems in this video that else is paired with while, and this worked out.
Python is the only language I know that allows an "else" after a loop. It is executed if and when the loop ends by failing the conditional expression. It is not executed if you "break" out of the loop.
Yes, it is right.
Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.
I forgot my password