There's the % sign. It's not just for the remainder, it is the modulo operation.

Answer from eduffy on Stack Overflow
🌐
Readthedocs
mod.readthedocs.io › en › latest
mod – modular arithmetic in Python — mod 0.3.0 documentation
Modular arithmetic is arithmetic ... including: music, banking, book publishing, cryptography… and of course math. The purpose of this package is to simplify the use of modular arithmetic in Python3....
🌐
ResearchGate
researchgate.net › publication › 361307525_18_Math_Module_Functions_in_Python
(PDF) 18. Math Module Functions in Python
June 15, 2022 - The math module has a set of methods and constants. ... Return the arc cosne (measured n radans) of x. The result s between 0 and p. The parameter must be a double value between -1 and 1. ... Return the arc cosine (measured in radians) of x. The result is between 0 and pi. ... Return the inverse hyperbolic cosine of x. ... localhost:8888/notebooks/Desktop/PROGRAMMING/PYTHON...
Discussions

How to calculate a mod b in Python? - Stack Overflow
Is there a modulo function in the Python math library? Isn't 15 % 4, 3? But 15 mod 4 is 1, right? More on stackoverflow.com
🌐 stackoverflow.com
Modulo operator
A modulo is a mathematical operator used in modular arithmetic You can think about modular arithmetic like how time on an analog clock works. In a 12 hr clock, if it’s currently 10, in 3 hours it will be 1, not 13. This is expressed as 10 + 3 mod 12. The modulo operator returns that result. num = (10 + 3) % 12 print(num) Would output 1. People like thinking about this as the remainder, but that’s not really accurate. For example: -1 % 4 would actually equal 3. If you think about a 4-hr clock and go back 1 hour, you end up at 3. More on reddit.com
🌐 r/learnpython
48
24
November 22, 2023
How come Python performs modulo operation so quickly, even when the dividend and thre divisor are extremely big?
Computers are fast. Modern CPUs can do arithmetic operations in one clock cycle, so a 2GHz CPU can do 2 billion arithmetic operations per second. When dealing with large numbers, Python breaks them down into repeated calculations using smaller numbers, in a similar way to how humans do long division. But even if it needs to do loads of operations, it still feels instant, because CPUs are so fast. More on reddit.com
🌐 r/Python
88
167
May 25, 2023
Inaccurate results using mod operator in python
This looks like an example of floating point numbers not being accurate, e.g. if you ask what 0.1 * 3 is you don't get 0.3, you get 0.30000000000000004. Not sure if there are ways round it in general, but if you know that you'll only use numbers with few decimal places you can use round() so that 0.30000000000000004 becomes 0.3, or truncate/floor/ceiling. More on reddit.com
🌐 r/learnpython
15
4
January 29, 2024
🌐
Real Python
realpython.com › python-modulo-operator
Python Modulo Operator (%): How to Use Mod in Python – Real Python
April 1, 2023 - In the next section, you’ll look at the basics of using the Python modulo operator with the numeric types int and float. ... The modulo operator, like the other arithmetic operators, can be used with the numeric types int and float. As you’ll see later on, it can also be used with other types like math.fmod(), decimal.Decimal, and your own classes.
🌐
Python
docs.python.org › 3 › library › math.html
math — Mathematical functions
1 month ago - This module provides access to common mathematical functions and constants, including those defined by the C standard. These functions cannot be used with complex numbers; use the functions of the ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › what-is-a-modulo-operator-in-python
Modulo operator (%) in Python - GeeksforGeeks
December 20, 2025 - Here, a is divided by b, and the modulo operator returns the remainder left after the division. Python also supports modulo operations with floating-point and negative numbers.
Find elsewhere
🌐
DataCamp
datacamp.com › tutorial › modulo-operator-python
Modulo Operator in Python: Understanding Key Concepts | DataCamp
March 12, 2025 - Learn how to create and import Python modules. Discover best practices, examples, and tips for writing reusable, organized, and efficient Python code! ... Squaring in Python is easy: Use the in-built ** operator or try NumPy, pow(), math.pow(), bitwise operators, and other functions for more versatile solutions.
🌐
Python Central
pythoncentral.io › how-to-use-the-operator-a-set-of-python-modulo-examples
How To Use The % Operator: A Set of Python Modulo Examples | Python Central
April 27, 2023 - Now that you understand how the modulo operation works in arithmetic let's see how you can use the operation in Python. The % operator is like any other arithmetic operator in Python, and you can use it with int and float numeric types. You can also use the operator in classes you create and with existing methods like math.fmod().
🌐
Analytics Vidhya
analyticsvidhya.com › home › python modulo operator
Python Modulo Operator
April 28, 2025 - It’s a fundamental concept in programming and mathematics with many applications. Also Read: Python Operators: A Comprehensive Guide · Division: The modulo operation involves two numbers. The first number is divided by the second number.
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › modulus in python
Modulus in Python | Definition, Syntax & Use Cases
June 2, 2025 - For example, -17 % 5 returns 3. The math.fmod() function provides more precision than the % operator when calculating the modulus for floating-point numbers, especially with very small or large decimal numbers.
🌐
AskPython
askpython.com › home › python modulo – % operator, math.fmod() examples
Python Modulo - % Operator, math.fmod() Examples - AskPython
February 16, 2023 - Python modulo operator always return the remainder having the same sign as the divisor. This can lead to some confusion with the output. ... The behavior of % operator with negative numbers is different from the platform C library. If you want the modulo operation to behave like C programming, you should use math module fmod() function.
🌐
Hyperskill
hyperskill.org › university › python › modulo-operator-in-python
Modulo Operator in Python
July 23, 2024 - This course is dedicated to core Python skills that will give you a solid base and allow you to pursue any further direction, be it Backend Development or Data Science. ... The modulo operator, often denoted as “%”, is a mathematical operation that finds the remainder when one number is ...
🌐
Career Karma
careerkarma.com › blog › python › how to use the python modulo operator
How to Use the Python Modulo Operator | Career Karma
December 1, 2023 - The modulo operator allows you to determine if a number is odd or even. Remember from math class that numbers divisible by two are even and any other number is odd.
🌐
GitHub
github.com › camoverride › lit › blob › master › Doing-Math-With-Python.pdf
lit/Doing-Math-With-Python.pdf at master · camoverride/lit
Literature for the self-taught AI practitioner! 📚. Contribute to camoverride/lit development by creating an account on GitHub.
Author   camoverride
🌐
PyPI
pypi.org › project › modulo
modulo
JavaScript is disabled in your browser. Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Medium
amenoren.medium.com › pythons-modulo-5180441434dc
Python’s Modulo Operator - Annika Noren - Medium
November 16, 2020 - Additionally, a negative float or integer can be used with the modulo operator or math.fmod(). The result takes the sign of the denominator, not the numerator. Key to keep in mind! ... Python also has a built-in function called the divmod(a,b) that will return the quotient and remainder as ...
🌐
PrepBytes
prepbytes.com › home › python › python mod function
Python Mod() Function
August 17, 2023 - Explanation: In this implementation, we use the fmod() function from the math module to calculate the remainder of the division operation.
🌐
W3Schools
w3schools.com › python › ref_math_fmod.asp
Python math.fmod() Method
Python Overview Python Built-in Functions Python String Methods Python List Methods Python Dictionary Methods Python Tuple Methods Python Set Methods Python File Methods Python Keywords Python Exceptions Python Glossary · Built-in Modules Random Module Requests Module Statistics Module Math Module ...
🌐
Codingem
codingem.com › home › modulo (%) in python: a complete guide (10+ examples)
Modulo (%) in Python: A Complete Guide (10+ Examples)
November 8, 2022 - In Python, a common way to calculate modulo is using the dedicated modulo operator %. Alternatively, if you want to know both the result of the division and the remainder, you can use the built-in divmod() function.