if, elif not working as expected
<p>I am new to Python and I do not know why but the <code>if</code>, <code>elif</code> in the following code is not working as I expect it to. However,</p>

<ul>
<li><p>It works perfectly when I type 1 to 7</p></li>
<li><p>it works perfectly when I type 0 8 or 9 (it says "Try again")</p></li>
<li><p>It does not work if I type 10 to 69, 100 to any number</p></li>
</ul>

<p>When I say it does not work I mean it prints </p>

<pre><code>my_shape_num = h_m.how_many()
</code></pre>

<p><strong>But I do not know why. It has to stop if choice is not between 1  and 7</strong></p>

<pre><code>def main(): # Display the main menu
    while True:
        print
        print "  Draw a Shape"
        print "  ============"
        print
        print "  1 - Draw a triangle"
        print "  2 - Draw a square"
        print "  3 - Draw a rectangle"
        print "  4 - Draw a pentagon"
        print "  5 - Draw a hexagon"
        print "  6 - Draw an octagon"
        print "  7 - Draw a circle"
        print
        print "  X - Exit"
        print

        choice = raw_input('  Enter your choice: ')

        if (choice == 'x') or (choice == 'X'):
            break

        elif (choice &gt;= '1' and choice &lt;= '7'):
            my_shape_num = h_m.how_many()
            if ( my_shape_num is None): 
                continue

            d_s.start_point() # start point on screen

            if choice == '1': 
                d_s.draw_triangle(my_shape_num) 
            elif choice == '2': 
                d_s.draw_square(my_shape_num) 
            elif choice == '3':             
                d_s.draw_rectangle(my_shape_num) 
            elif choice == '4':             
                d_s.draw_pentagon(my_shape_num) 
            elif choice == '5':             
                d_s.draw_hexagon(my_shape_num) 
            elif choice == '6':             
                d_s.draw_octagon(my_shape_num) 
            elif choice == '7': 
                d_s.draw_circle(my_shape_num)

        else:
            print
            print '  Try again'
            print
</code></pre>

<hr>

<p>Edit: Ok, sorted:</p>

<pre><code>choice = raw_input('  Enter your choice: ')

if (choice == 'x') or (choice == 'X'):
    break


try:
    choice = int(choice)
    if (1 &lt;= choice &lt;= 7):

        my_shape_num = h_m.how_many()
        if ( my_shape_num is None): 
            continue

        d_s.start_point() # start point on screen

        if choice == 1: 
            d_s.draw_triangle(my_shape_num) 
        elif choice == 2: 
            d_s.draw_square(my_shape_num) 
        elif choice == 3:             
            d_s.draw_rectangle(my_shape_num) 
        elif choice == 4:             
            d_s.draw_pentagon(my_shape_num) 
        elif choice == 5:             
            d_s.draw_hexagon(my_shape_num) 
        elif choice == 6:             
            d_s.draw_octagon(my_shape_num) 
        elif choice == 7: 
            d_s.draw_circle(my_shape_num)

    else:
        print
        print '  Number must be from 1 to 7!'
        print

except ValueError:
    print
    print '  Try again'
    print
</code></pre>
