title: Validate input for nested list in python
body: <p>newbie for python here.</p>
  
  <p>i'm trying to validate if user input is empty for a nested list to store (x y coordinate). If user did not input anything, codes should be displaying a message e.g. "No input" and will loop back prompting the user to input.  </p>
  
  <p>Had been searching everywhere on validate empty nested list, or validate empty input but i just can't put the knowledge together. An example of the code is display below:</p>
  
  <pre><code>add = "y"
  xy = []
  
  #-------------------------------------
  def count_list(l):
      count = 0
      for e in l:
          if isinstance(e, list):
              count = count + 1 + count_list(e)
      return count
  #--------------------------------------
  
  while (add == "y"):
  
      xy.append([(input("Input x value: ")), (input("Input y value: "))])
  
      add = input("Additional (x, y)? [y/n] ")
  
  qty = (count_list(xy))
  
  print ("(x, y) coordinate(s) inserted:- " + str(xy))
  
  print ("No. of coordinate(s) inserted:- " + str(qty))
  </code></pre>
  
  <hr>
  
  <p><strong>Output</strong></p>
  
  <p><a href="https://i.stack.imgur.com/XRRum.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XRRum.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>Had been cracking my brain for this. Notice 2nd nested list is empty. Am trying to find out how stop the code to proceed but instead prompting the user with a msg "no input". The position of the empty nested list should not be added into the list.</p>
  
  <p>Also have no idea why my count_list function also include counting in an empty nested list. T_T</p>