title: Python assert not working: limit user enter only stated numbers but assert not working
body: <p>Beginner here. I try to create a lottery game by with 6 numbers entry. The code below try to check the user enter the numbers: first, whether it's integer; second whether it's in the range which stated. However, the check of int by ValueError was working but not the range of number check by assert.</p>
  <pre><code>def buy_lottery_ticket():
      global credit
      credit -= 5
      while True:
          try:
              entered_numbers = input('Enter your 6 favorites numbers!(1 ~ 20): ')
              entered_numbers_list = entered_numbers.split(',')
              ticket_numbers = {int(n) for n in entered_numbers_list}
              print(ticket_numbers)
              return ticket_numbers
              assert 0 &lt; entered_numbers_list &lt; 21
          except ValueError:
              print(&quot;Not an integer! Please enter an integer.&quot;)
          except AssertionError:
              print(&quot;Please enter an integer between 1 and 20&quot;)
          else:
              break
  </code></pre>
  <p>Appreciate your input and help. Thanks in advance.</p>