Skip to content
Sign upLog in
Beginner - ending a game
Profile icon
edimoo

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 :(

You are viewing a single comment. View All
Profile icon
BenjaminOBrien

First off, you dont need print(restart()), 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:

while True: pass

You could also do this:

from time import sleep sleep(999) # or any amount of seconds to cause an infinite loop

Hope that helped. :D

Profile icon
edimoo

@BenjaminOBrien
hey! thanks so much! It definitely did help :)

Profile icon
BenjaminOBrien

@edimoo
No problem. :)