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
🌐
W3Schools
w3schools.com › python › python_math.asp
Python Math
import math x = math.pi print(x) Try it Yourself » · In our Math Module Reference you will find a complete reference of all methods and constants that belongs to the Math module.
🌐
Python
docs.python.org › 3 › library › math.html
math — Mathematical functions
3 weeks ago - For small floats x, the subtraction in exp(x) - 1 can result in a significant loss of precision; the expm1() function provides a way to compute this quantity to full precision: >>> from math import exp, expm1 >>> exp(1e-5) - 1 # gives result ...
🌐
Quora
quora.com › How-do-I-import-a-math-library-in-Python
How to import a math library in Python - Quora
Answer (1 of 7): It depends which math library - if you mean the standard library [1] : [code]import math [/code]If you mean some other library (maybe scipy, or sympy, or numpy) then you need to install them first (using pip install …) and then import them as you need to based on the documentat...
🌐
CodeHS
codehs.com › tutorial › ryan › math-module-in-python
Tutorial: Math Module in Python | CodeHS
Click on one of our programs below to get started coding in the sandbox
🌐
Mimo
mimo.org › glossary › python › math-module
Mimo: The coding platform you need to learn Web Development, Python, and more.
The math module in Python is built-in, meaning you don’t need to install it separately. To access its functions, import it using:
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-math-module
Python Math Module - GeeksforGeeks
July 26, 2025 - Example: This prints the trigonometric values of π/6. ... import math a = math.pi/6 print ("The value of sine of pi/6 is : ", end="") print (math.sin(a)) print ("The value of cosine of pi/6 is : ", end="") print (math.cos(a)) print ("The value ...
🌐
LabEx
labex.io › tutorials › python-how-to-import-math-functions-safely-446106
How to import math functions safely | LabEx
Learn essential Python techniques for importing and using math functions with error handling and best practices for safe and efficient mathematical operations.
🌐
Dummies
dummies.com › article › technology › programming-web-design › python › how-to-import-python-modules-264467
How to Import Python Modules | dummies
June 27, 2025 - In other words, after you execute this: from math import *<?pre> … you can do a command like print(pi) and it will work, even without using print(math.pi). Although it does seem like a smart and convenient thing to do, many Python programmers think that sort of thing isn't very Pythonic.
🌐
Geo-python
geo-python.github.io › site › develop › notebooks › L4 › modules.html
Loading and using modules — Geo-Python site documentation
August 17, 2020 - Here we have loaded the math module by typing import math, which tells Python to read in the functions in the math module and make them available for use.
🌐
Steemit
steemit.com › programming › @thetalcumtaco › learning-python-programming-part-3-imports-modules-math-and-functions
Learning Python Programming - Part 3 - Imports, modules, math, and functions — Steemit
September 29, 2016 - How do we import something into my code? To import something you must write an "import statement" at the top of your code. This statement can look like any of the following: import math import math as Math from math import sqrt from math import pi as pie
🌐
Oreate AI
oreateai.com › blog › mastering-the-math-module-a-guide-to-importing-in-python › 44c394650f550038886978d28640d49d
Mastering the Math Module: A Guide to Importing in Python - Oreate AI Blog
December 31, 2025 - Alternatively, if you're only interested in specific functions from within that vast library—say just calculating square roots—you can use: from math import sqrt a = sqrt(25) print(a) # Output: 5.0 · By importing directly like this, you can call sqrt() without needing to prefix it with math.
🌐
W3Schools
w3schools.com › python › ref_math_pi.asp
Python math.pi Constant
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... The math.pi constant returns the value of PI: 3.141592653589793. Note: Mathematically PI is represented by π. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
🌐
Python
docs.python.org › 3 › library › turtle.html
turtle — Turtle graphics
3 weeks ago - Other than for very basic introductory purposes, or for trying things out as quickly as possible, it’s more usual and much more powerful to use the object-oriented approach to turtle graphics. For example, this allows multiple turtles on screen at once. In this approach, the various turtle commands are methods of objects (mostly of Turtle objects). You can use the object-oriented approach in the shell, but it would be more typical in a Python script. ... from turtle import Turtle from random import random t = Turtle() for i in range(100): steps = int(random() * 100) angle = int(random() * 360) t.right(angle) t.fd(steps) t.screen.mainloop()
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-math-prod-method
Python - math.prod() method - GeeksforGeeks
January 23, 2020 - # Python Program to explain math.prod() method # Importing math module import math # By default start value is 1 # but can be explicitly provided # as a named (keyword-only) parameter # list arr = [1, 2, 3, 4, 5] # Calculate the product of # ...
🌐
STEMpedia
ai.thestempedia.com › home › pictoblox extensions › python math module
Tutorial on Python Math Module: Definition, Usecase & Examples
June 27, 2023 - Below is the example of using math module to calculate the natural logarithm of a number. import math # initializing the number number = 50 # calculating natural log of number natural_log = math.log(number) # printing the natural log of number print("The natural log of", number, "is", natural_log)
🌐
Python
docs.python.org › 3 › library › index.html
The Python Standard Library — Python 3.14.3 documentation
types — Dynamic type creation and names for built-in types · copy — Shallow and deep copy operations · pprint — Data pretty printer · reprlib — Alternate repr() implementation · enum — Support for enumerations · graphlib — Functionality to operate with graph-like structures · Numeric and Mathematical Modules ·