Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to restart your program in Python?

+2 votes
asked Jan 29 by Jeff The Chicken (2,810 points)
Do you use the sys module?

1 Answer

+1 vote
answered Jan 29 by Peter Minarik (19,180 points)
selected Feb 13 by Jeff The Chicken
 
Best answer
Use classes and functions.

When you want to start over, use functions to reset the state of your objects and call the function where your code beings.

Alternatively, you can put your whole code in a loop with some exit condition, which can control whether "restart" is required or not.
commented Jan 29 by Jeff The Chicken (2,810 points)
What do you mean by "use functions to reset the state of your objects and call the function where your code beings"?
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...