pow is built into the language(not part of the math library). The problem is that you haven't imported math.
Try this:
import math
math.sqrt(4)
Answer from dave on Stack OverflowPython
docs.python.org › 3 › library › math.html
math — Mathematical functions — Python 3.15.2 documentation
>>> from math import exp, expm1 >>> exp(1e-5) - 1 # gives result accurate to 11 places 1.0000050000069649e-05 >>> expm1(1e-5) # result accurate to full precision 1.0000050000166668e-05
Python math module - Stack Overflow
See python library, and the list of built-ins. President James K. Polk – President James K. Polk · 2012-01-09 02:22:23 +00:00 Commented Jan 9, 2012 at 2:22 · I'm trying to imagine a scenario where you wouldn't want math to be imported automatically on startup. More on stackoverflow.com
Is "from math import *" and "import math" equivalent?
Nope: import math print(math.sqrt(4)) Vs from math import * print(sqrt(4)) The first is generally recommended, as it's more explicit about where things are coming from. More on reddit.com
[Python] The difference between "import math" and "from math import *"
The first method imports using the math namespace. You would use the sqrt function like this: math.sqrt(x)
The second method imports all the methods from math into the current namespace. You would use the sqrt function like this: sqrt(x)
Usually you want to use the first method, so you can avoid errors caused by functions having the same name.
I may have been in math club, but the python Math module confuses me a little bit.
I have yet to really need it for a lot of things. Yes, maybe you can use the exponentiation operator ** to perform a square root, but there's a lot more in the math module than that. There's all the trig functions, hyperbolic functions as well as mathematical operations like factorial and GCD, not to mention the constants e, pi, tau, etc. If you need these things you need the math module. You just haven't needed them yet. More on reddit.com
06:18
Python Math Module Functions - Programming Examples Tutorial - YouTube
10:50
Working with Module with Math in Python | 16 - YouTube
08:33
Math Module | Python Programming Ep. 29 - YouTube
07:39
#15 Python Tutorial for Beginners | Import Math Functions in Python ...
04:51
Python math functions 🧮 - YouTube
13:47
How to: Plot a Function in Python - YouTube
Altcademy
altcademy.com › blog › how-to-import-math-in-python
How to import math in Python - Altcademy.com
September 12, 2023 - Just think of it as a box, filled with different tools or functions that perform specific tasks. In the case of the Math module, this box contains tools that help us perform mathematical operations. To use any module in Python, we first need to import it. Think of it as taking the box of tools out of the storage and keeping it ready for use.
Real Python
realpython.com › python-math-module
The Python math Module: Everything You Need to Know – Real Python
March 18, 2026 - The Python math module is an important feature designed to deal with mathematical operations. It comes packaged with the standard Python release and has been there from the beginning. Most of the math module’s functions are thin wrappers around the C platform’s mathematical functions.
Reddit
reddit.com › r/learnpython › is "from math import *" and "import math" equivalent?
r/learnpython on Reddit: Is "from math import *" and "import math" equivalent?
January 21, 2023 -
I'm a beginner in python and in general programming, and I don't know if these two call for summoning math functions are the same
Top answer 1 of 16
377
Not exactly. ‘From math important *’ Says “bring the box of math tools and dump it out on the table with the rest of my tools.” Calls look like: ‘Thing_from_math()’ Whereas ‘import math’ says “bring me the box of math tools and I’ll grab the tools as I need them”. Calls should look like: ‘Math.thing_from_math()’ And finally: ‘From math import thing_from_math’ Says “bring me the box of math tools and only unpack the specific tools I asked for. Calls look like: ‘thing_from_math()’
2 of 16
212
Nope: import math print(math.sqrt(4)) Vs from math import * print(sqrt(4)) The first is generally recommended, as it's more explicit about where things are coming from.
CodeGenes
codegenes.net › blog › how-to-import-math-into-python
Importing the Math Module in Python: A Comprehensive Guide — codegenes.net
# Good practice: use an alias or full import import math sin_value = math.sin(math.pi / 2) The math module in Python is a powerful tool for performing a wide range of mathematical operations. By understanding how to import the module, its various usage methods, and following common and best practices, you can write more efficient and error-free code.
Scientech Easy
scientecheasy.com › home › blog › math module in python
Math Module in Python - Scientech Easy
February 10, 2026 - A math module in Python is a built-in module that contains a set of commonly used mathematical functions and constants for performing various mathematical tasks. To use functions from the math module, we need to import it into the Python program code or script using the import statement.
Stanford CS
cs.stanford.edu › people › nick › py › python-math.html
Python Math
This was thought to be the least confusing approach for the many Python users who do not want to introduce complex numbers. For those wanting functions with complex number support, use the cmath module and its included sqrt(), sin(), etc. functions instead of the regular math functions (cmath docs). >>> import cmath >>> cmath.sqrt(-1) 1j >>> cmath.sin(1j) 1.1752011936438014j
CodeHS
codehs.com › tutorial › 13325
Tutorial: Math Module in Python | CodeHS
Python Tutorial · python · By Zach Galant · High School · javascript · By Ryan Hart · High School · All Products · Coding LMS · CodeHS Pro · Computer Science Curriculum · Certifications · Professional Development · AI Creator · Typing · Cyber Range ·
Programiz
programiz.com › python-programming › modules › math
All Mathematical Functions Defined under Math Module in Python 3
December 26, 2022 - The math module is a standard module in Python and is always available. To use mathematical functions under this module, you have to import the module using import math.
University of Vermont
uvm.edu › ~cbcafier › cs1210 › book › 05_functions › intro_to_math_module.html
Introduction to the math module: pi and sqrt() – Clayton Cafiero
January 28, 2026 - It provides many functions including · and many others. The math module also supplies values for \pi and e. To import a module, we use the import keyword. Imports should appear in your code immediately after the starting docstring, and you only need to import a module once.