Beginner - ending a game
Hi! I can't figure out how to make it so that the game ends when the user types "no" into the restart()) section under my code.
I'm a beginner, and I am quite frustrated :(
Howdy, I am sure that you have heard at any rate once in your life from a mate, an inconceivable story of winning in an online club, or winning a bet. I figure you didn't really trust in such pieces of jibber jabber, yet envision a situation wherein I uncovered to you that this happened to me also, and it essentially totally transformed me, when assistant asked me this site - https://nieuwecasinos-nl.com/ it is truly trustworthy and doesn't obstruct customers who sound money win.
To end a game, just first do
sys.exit() where you want it to stop.
I wouldn’t recommend doing
sleep(999) because then the user might not know if the repl is done or not.
Hope this helps!
First off, you dont need
restart() will work as well. Second, make sure you place your
restart() function calls in the right place, or else your game will continue to play even though you attempted to restart.
Also, if you just want the game to hang if the user types no, then just setup a
while True loop like so:
You could also do this:
Hope that helped. :D
I think you just put
return in there. Im not completely sure though.