title: Python's type() function and its 'if' related problems
body: <p>So I have the following code:</p>
  
  <pre><code>user_input = raw_input("Enter an integer, string or float:")
  input_type = type(user_input)
  
  if input_type == "str":
      print "Your string was %s." % user_input
  
  elif input_type == "int":
      input_type = int(input_type)
      print "Your integer was %d." % user_input
  
  elif input_type == "float":
      input_type = int(input_value)
      print "Your float was %d." % user_input
  
  else:
      print "You did not enter an acceptable input."
  </code></pre>
  
  <p>This <strong>does not</strong> work — I believe because of the <code>if</code> — so I changed it to be:</p>
  
  <pre><code>if "str" in input_type
  </code></pre>
  
  <p>and <code>"int"</code> for the float and integer, but get an error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "types.py", line 4, in &lt;module&gt;
  if "str" in input_type:
  TypeError: argument of type 'type' is not iterable
  </code></pre>
  
  <p>Why do I get this and how can I fix it?</p>