python name not defined even though it is
<p>I know this is basic but i actually don't even know what I've done wrong.</p>

<pre><code>while True:
    try:
        end=int(input("If You Dont Want To Buy Anything Press 1 To Exit\nOr If You Would Like To Try Again Please Press 2"))
    except ValueError:
        print("\nPlease Enter Only 1 Or 2")
    if end==1:
        exit()
    elif end==2:
        continue
</code></pre>

<p>I have literally defined end at the start and yet the error is <code>NameError: name 'end' is not defined</code> I've even tried making end a global. </p>