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 Overflow
🌐
Python
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
🌐
W3Schools
w3schools.com › python › python_math.asp
Python Math
Python has also a built-in module called math, which extends the list of mathematical functions. ... When you have imported the math module, you can start using methods and constants of the module.
Discussions

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
🌐 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
🌐 r/learnpython
53
160
January 21, 2023
[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.

More on reddit.com
🌐 r/learnprogramming
3
1
April 20, 2016
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
🌐 r/learnpython
7
2
June 19, 2021
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-math-module
Python Math Module - GeeksforGeeks
May 16, 2026 - To work with mathematical constants and functions in Python, you need to import the math module:
🌐
Real Python
realpython.com › ref › stdlib › math
math | Python Standard Library – Real Python
The Python math module provides a collection of common mathematical functions and constants, including those defined by the C standard. It includes functions for trigonometry, logarithms, powers, and other mathematical calculations.
🌐
Mimo
mimo.org › glossary › python › math-module
Python Math Module: Syntax, Usage, and Examples
Yes, the math module is part of Python's standard library, so it does not require installation. It is included with Python distributions and can be used immediately after import.
🌐
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.
Find elsewhere
🌐
LabEx
labex.io › tutorials › python-how-to-import-math-functions-safely-446106
How to import math functions safely | LabEx
Always import the entire module or specific functions ... Note: For LabEx learners, understanding the math module is crucial for advanced Python programming and scientific computing tasks.
🌐
OpenStax
openstax.org › books › introduction-python-programming › pages › 2-6-the-math-module
2.6 The math module - Introduction to Python Programming | OpenStax
March 13, 2024 - This module defines functions such as sqrt() (square root). To call sqrt(), a program must import math and use the resulting math variable followed by a dot.
🌐
Tutorial Teacher
tutorialsteacher.com › python › math-module
Python math Module
import math print(math.ceil(4.5867)) #output: 5 print(math.floor(4.5687)) #output: 4 · Try it · Learn more about math module on Python docs.
🌐
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 ·
🌐
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.
🌐
TechVidvan
techvidvan.com › tutorials › python-math-module-python-for-mathematics
Python Math Module - Python for Mathematics - TechVidvan
March 24, 2023 - Additionally, the math module also provides constants such as pi and e. To use the functions and constants provided by the math module, you need to import it using the import statement.
🌐
Dummies
dummies.com › article › technology › programming-web-design › python › how-to-import-python-modules-264467
How to Import Python Modules | dummies
September 25, 2019 - To do that, you just follow the import command with the name of the Python module you want to import. For example, this imports the entire math module, which has lots of functions and stuff for doing math:
Author:
🌐
CodeGenes
codegenes.net › blog › how-to-import-math-in-python
How to Import Math in Python — codegenes.net
In Python, the math library is a built-in library, which means you don't need to install it separately. To start using the functions and constants provided by the math library, you need to import it into your Python script.
🌐
Dataquest
dataquest.io › home › blog › python math module guide (22 examples and 18 functions)
Simple Python Math Module Guide (22 Examples and 18 Functions)
May 9, 2026 - math is a built-in module in the Python 3 standard library that provides standard mathematical constants and functions. You can use the math module to perform various mathematical calculations, such as numeric, trigonometric, logarithmic, and ...
🌐
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.
🌐
Hyperskill
hyperskill.org › university › python › math-in-python
Math in Python
August 2, 2024 - To access mathematical functions in Python, the math module needs to be imported. The import statement is used at the beginning of the script.