title: Unable to get the type of data user inputs
body: <p>I am trying to get the type of data user inputs, but I am getting some issues with code. I tried with the below code:</p>
  
  <pre><code>def user_input_type():
  
      try:
          user_input = int(raw_input("Enter set of characters or digit"))
      except:
          try:
              user_input = str(user_input)
          except Exception as e:
              print e
          return type(user_input)
  
      return type(user_input)
  
  print user_input_type()
  </code></pre>
  
  <p>but it gives me 2 warnings before running the code.</p>
  
  <ol>
  <li>Local variable <code>user_input</code> might be referenced before assignment.</li>
  <li>Too broad exception clause such as no exception class specified, or specified as <code>Exception</code>.</li>
  </ol>
  
  <p>After running the code when I enter digits it gives me proper value  but when I enter character it gives me an error:</p>
  
  <blockquote>
    <p>UnboundLocalError: local variable 'user_input' referenced before assignment</p>
  </blockquote>
  
  <p>Please help.</p>