Open links in new tab
  1. Python provides a built-in module called math that offers a wide range of mathematical functions and constants. This module is essential for performing various mathematical operations, from basic arithmetic to complex trigonometric calculations.

    Basic Usage

    To use the math module, you need to import it first:

    import math
    Copied!

    Common Functions

    Here are some commonly used functions in the math module:

    • math.ceil(x): Returns the smallest integer greater than or equal to x.

    • math.floor(x): Returns the largest integer less than or equal to x.

    • math.fabs(x): Returns the absolute value of x.

    • math.factorial(x): Returns the factorial of x.

    • math.gcd(x, y): Returns the greatest common divisor of x and y.

    • math.sqrt(x): Returns the square root of x.

    • math.pow(x, y): Returns x raised to the power of y.

    • math.log(x, base): Returns the logarithm of x to the specified base.

    Example:

    Feedback
  2. Python math Module - W3Schools

    50 rows · Learn how to use the built-in math module in Python for various mathematical tasks. The …

  3. Python Math Module - GeeksforGeeks

    Jul 26, 2025 · The math module in Python is a built-in library that contains a collection of mathematical functions and constants. It is commonly used to perform standard math operations such as rounding, …

  4. The Python math Module: Everything You Need to Know

    Learn how to use the math module in Python for higher-level mathematical operations, such as exponential, logarithmic, trigonometric, and power functions. …

  5. All Mathematical Functions Defined under Math Module in Python 3

    45 rows · Learn how to use the math module in Python to access various mathematical functions and constants. See the list of functions, their descriptions, and examples of how to apply them in your code.

  6. Python - math Module - Online Tutorials Library

    Learn how to use the math module in Python for performing mathematical operations. The module provides various methods for trigonometric, power, …

  7. People also ask
    Loading
    Unable to load answer
  8. Master Python's Math Module for Math Functions

    May 10, 2025 · Learn how to use Python's math module for basic and advanced math operations. It provides functions for square roots, powers, trigonometry, …

  9. Python Math Tutorial

    Explore Python’s math module with tutorials covering number-theoretic, power, logarithmic, trigonometric, and angular conversion functions. Learn syntax, examples, and applications of …

  10. 2.6 The math module - Introduction to Python …

    The complete list of built-in functions is available in Python's official documentation. A commonly used module in the standard library is the math …

  11. Python math Module - TutorialsTeacher.com

    Learn how to use the math module in Python to perform various mathematical operations and calculations. The module provides functions for trigonometry, logarithms, exponents, powers, roots, …