classification
Title: math function sqrt() not working in 3.9
Type: Stage: resolved
Components: IDLE Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, mikeuser_01, terry.reedy
Priority: normal Keywords:

Created on 2020-12-03 13:16 by mikeuser_01, last changed 2020-12-03 16:21 by terry.reedy. This issue is now closed.

Messages (3)
msg382411 - (view) Author: mike dalrymple (mikeuser_01) Date: 2020-12-03 13:16
Downloaded Python 3.9.0
Documentation indicates:
math.sqrt(x)
Return the square root of x.

When I use in IDLE shell 3.9.0, I receive error:
>>> sqrt(25)
Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    sqrt(25)
NameError: name 'sqrt' is not defined

What is the problem?
msg382412 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-12-03 13:20
You have to import the math module first and then reference the sqrt function of the math module.

>>> import math
>>> math.sqrt(25)
5.0
msg382425 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-12-03 16:21
Mike, please ask questions on question forums such as python-list (mail.python.org) or stackoverflow.com, where other beginners can see the answer.  Also, IDLE is not Python.  In particular, python's response to code you send to python usually has nothing to do with IDLE.
History
Date User Action Args
2020-12-03 16:21:42terry.reedysetassignee: terry.reedy ->
messages: + msg382425
2020-12-03 13:20:05christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg382412

resolution: not a bug
stage: resolved
2020-12-03 13:16:51mikeuser_01create