title: How to check if input is digit and in range at the same time? Python
body: <p>I would like to check if my input is digit and in range(1,3) at the same time and repeat input till I got satisfying answer.
  Right now I do this in this way, but the code is quite not clean and easy... Is there a better way to do this?
  Maybe with while loop?</p>
  
  <pre><code>def get_main_menu_choice():
      ask = True
      while ask:
          try:
              number = int(input('Chose an option from menu: '))
              while number not in range(1, 3):
                  number = int(input('Please pick a number from the list: '))
              ask = False
          except: # just catch the exceptions you know!
              print('Enter a number from the list')
     return number
  </code></pre>
  
  <p>Will be grateful for help.</p>