Python-Restart the application?

We’ve been making quite a few stupid little game in Python

At the conclusion, I have:

screen-print “Game about.Player “, move, “wins! \nPlay yet again Y/N”

How to make it so going into Y will let these people play all over again and D will depart the program

Well, firstly that “Game over” information should moderately be some sort of raw_input.

def wannaPlayAgain():
play_again = raw_input(‘Play yet again Y/N’)

In which case you make a strong if statement, and website it towards the function the location where the game gets going.Let’s state that function is known as firstfunc().

in case play_again == ‘Y’:
firstfunc()
elif play_again == ‘N’:
break
different:
print “Answer just isn’t valid.”
wannaPlayAgain().

Leave a Reply