title: How to do math expression from input() in Python?
body: <p>I have a situation when I have to convert user's input to int and do math operation:</p>
  
  <pre><code>    import ast
      user_input = input()
  
      if user_input.isdigit():
          print('it is a number:', ast.literal_eval(user_input))
      elif user_input.isalpha():
          print('it is a string')
      elif user_input.isalnum():
          print('it is something mixed')
      else:
          print('can\'t recognize', user_input)
  </code></pre>
  
  <p>The first case <strong>if user_input.isdigit</strong> doesn't work if there is a math expression like <strong>2 + 2</strong> or <strong>5 * 5</strong>. What`s wrong?</p>