title: python basics , why exception handling is not working?
body: <p>Am new to python development and trying to understand exception handling.
  I have 2 functions 1st to find 1 occurrence of duplicate value in a list and 2nd to call the function.
  But if try to pass the name of list that does not exist it should print message from except block , but its not working , please help </p>
  
  <pre><code>def first_duplicate(a):
      x = 0
      for i, j in enumerate(a):
          for k in a[i + 1:]:
              if j == k:
                 x = 1
                  return j
          if x == 1:
              break
  
  
  def call_main (list_name):
      try:
          x = first_duplicate(list_name)
          if x is None:
              print("No duplicates")
          else:
              print(x, "is the first duplicate")
      except NameError:
              print("exception occurred Name ")
      except ValueError:
              print("exception occurred value")
  </code></pre>
  
  <p>my command is like</p>
  
  <pre><code>call_main(y)
  </code></pre>
  
  <p>where I have not created the list : y , it should print the exception message in this case but its not , please help </p>