Reading math function issue
<p>Here is my code</p>

<pre><code>import math

try:

    valor = float(input("Give a real number "))
    print("Your value given is: ", value)
except ValueError:

    print("You gave a value not interpretable as a real onel!!")
</code></pre>

<p>And when my input is <code>sqrt(2)</code>, I got this error, anyone knows why?</p>

<pre><code>%run "c:\users\aar15\appdata\local\temp\tmpvzauzz.py"

Give a real number sqrt(2)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

c:\users\aar15\appdata\local\temp\tmpvzauzz.py in &lt;module&gt;()

      1 import math
      2 try:
----&gt; 3     valor = float(input("Give a real number "))

      4     print("Your value given is: ", value)
      5 except ValueError:

C:\Users\aar15\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\site-packages\IPython\kernel\zmq\ipkernel.pyc in &lt;lambda&gt;(prompt)

C:\Users\aar15\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\site-packages\IPython\kernel\zmq\ipkernel.pyc in &lt;module&gt;()

NameError: name 'sqrt' is not defined 
</code></pre>

<p>As you can see from the <a href="https://docs.python.org/2/library/functions.html#input" rel="nofollow">doc</a>, <code>input</code> is equivalent to <code>eval(raw_input(prompt))</code>, but you can still make it work:</p>

<pre><code>&gt;&gt;&gt; import math
&gt;&gt;&gt; input()
math.sqrt(2)
1.4142135623730951
&gt;&gt;&gt; from math import *
&gt;&gt;&gt; input()
sqrt(2)
1.4142135623730951
</code></pre>

python math input nameerror