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.
🌐
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.
Find elsewhere
🌐
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.
🌐
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.
🌐
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
🌐
AskPython
askpython.com › python-modules › python-math-module
Python math Module - AskPython
December 31, 2019 - Python math module provides a constant called pi that can be used in mathematical computations, eg: area of a circle. ... import math print('Value of pi: ', math.pi) radius = 2 print('Area of Circle: ', math.pi * (radius ** 2))
🌐
Python Morsels
pythonmorsels.com › importing-module
Importing a module in Python - Python Morsels
July 18, 2026 - >>> math <module 'math' from '/usr/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so'> When we imported the math module, we got a module object, and that module object has attributes.
🌐
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.