Python not returning expected value
<p>I simply cannot understand what is happening here. The problem is important for my homework (studying programming so I'm a beginner... also my English is not that good, sorry).</p>

<p>I am trying to read a string... it can be either a number or a set number of commands.<br>
I'll just give a very small example of what I'm trying to do and what is going wrong.</p>

<pre><code>    def validate():
        choice = str(input("&gt;&gt;&gt; "))
        if (choice == "exit"):
            return 0 # should exit validate
        else:
            try:
                aux = int(choice) # Tries converting to integer
            except:
                print("Insert integer or exit")
                validate() # If it can't convert, prompts me to try again through
                           # recursivity
            else:
                return aux
    rezult = validate()
    print (rezult)
</code></pre>

<p>Problem is that this small script returns totally random stuff.</p>

<p>If "exit", returns "None".<br>
If first input is correct, it returns correct number.<br>
If first input is an "error" and second input is correct, it's "None" again and I simply can't understand what is going wrong... Why it doesn't want to work or what should I do (alternatively).</p>
