How can I make my program return to the beginning in Python?
<p>I'm a really new programmer, just programing for fun. I usually write my programs with a series of while loops to get to different sections of the program at different times. It's probably not the best way, but it's all I know how to do. </p>

<p>For example, I'm working on a little program that runs in a shell meant to solve an equation. Here's part of the program that's supposed to bring you back to the beginning.</p>

<pre><code>while loop==4:
    goagain = raw_input("Would you like to do the equation again? (Y/N)")
    if goagain == "Y":
        #Get values again
        loop=2
    elif goagain == "N":
        print "Bye!"
        #End program
        loop=0
    else:
        print"Sorry, that wasn't Y or N. Try again."
</code></pre>

<p>I have it set so that while loop==2, it gets the values to put into the equation and while loop==0, nothing happens. </p>

<p>The problem I have, though, is that when my loop changes back to 2, the program just ends there. It doesn't want to back in the code to where I told it what to do while loop==2.</p>

<p>So what I need to know is how to get my program to go back to that section. Should I use a different method than the while loops? Or is there a way to get my program to go back to that section?</p>

<p>Thanks!</p>
