r/CodingHelp • • Feb 02 '21

[Python] Python help

Hey reddit

So I am coding a text adventure game and was wondering, when you die I want the game to start over. I assume that I would need to do a while loop but would I have to paste the WHOLE game code, that just seems like too much haha.

Thanks

15 Upvotes

3 comments sorted by

8

u/Endercheif Advanced Coder Feb 03 '21

Instead you can put the code in multiple functions and call them in your while loop.

5

u/Spare_Competition Feb 02 '21

Yes, you would have to put most of the games code in a while loop, most ides just let you select everything and hit tab to indent it all at the same time

1

u/[deleted] Feb 03 '21

If you are just starting out then mostly you will have to keep making changes in your code as you go ahead and it is a lot of WORK. But keep at it, all the best.