Hey, I'm trying to make a program restart if a function (in this case playAgain) is true. Is there a simple way to do this?
Here's the end of my program:
theGame()
if playAgain() == True:
else:
quit()
Hey, I'm trying to make a program restart if a function (in this case playAgain) is true. Is there a simple way to do this?
Here's the end of my program:
theGame()
if playAgain() == True:
else:
quit()
You can use this structure
while True:
theGame()
if not playAgain():
break
quit()
You can find exercises and answers about that issue at:
http://www.upriss.org.uk/python/PythonCourse.html
Click 'Week 4...' Exercises, Answers.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.