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

Answer from eduffy on Stack Overflow
🌐
Python
docs.python.org › 3 › library › math.html
math — Mathematical functions
3 weeks 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 ...
🌐
Readthedocs
mod.readthedocs.io
mod – modular arithmetic in Python — mod 0.3.0 documentation
from mod import Mod # Funny math here x = Mod(5, 7) # x ≡ 5 (mod 7) (x + 2) == 0 # True: 5 + 2 ≡ 7 ≡ 0 (mod 7) (x + 7) == x # True: 5 + 7 ≡ 12 ≡ 5 (mod 7) (x**3) == (x + 1) # True: 5³ ≡ 125 ≡ 6 (mod 7) (1 // x) == 3 # True: 5 × 3 ≡ 15 ≡ 1 (mod 7) ⇒ 5⁻¹ ≡ 3 (mod 7)
🌐
Hyperskill
hyperskill.org › university › python › modulo-operator-in-python
Modulo Operator in Python
July 23, 2024 - This course is dedicated to core ... or Data Science. ... The modulo operator, often denoted as “%”, is a mathematical operation that finds the remainder when one number is divided by another....
🌐
Mimo
mimo.org › glossary › python › modulo-operator
Mimo: The coding platform you need to learn Web Development, Python, and more.
Use the Python modulo operator to get remainders, build cycles, and check parity with examples.
🌐
GeeksforGeeks
geeksforgeeks.org › python › what-is-a-modulo-operator-in-python
Modulo operator (%) in Python - GeeksforGeeks
December 20, 2025 - The modulo operator (%) in Python is used to find the remainder after dividing one number by another. It works with both integers and floating-point numbers and is commonly used in tasks like checking even or odd numbers, repeating patterns, ...
Find elsewhere
🌐
Real Python
realpython.com › python-modulo-operator
Python Modulo Operator (%): How to Use Mod in Python – Real Python
April 1, 2023 - Just like with the division operator (/), Python will return a ZeroDivisionError if you try to use the modulo operator with a divisor of 0: ... Next, you’ll take a look at using the modulo operator with a float. Similar to int, the modulo operator used with a float will return the remainder of division, but as a float value: ... An alternative to using a float with the modulo operator is to use math.fmod() to perform modulo operations on float values:
🌐
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.
🌐
GitHub
github.com › yoeo › mod
GitHub - yoeo/mod: Modular arithmetic in Python :100:
The purpose of this package is to simplify the use of modular arithmetic in Python3. This package provides Mod integers that compute arithmetic operations like + - * // ** with a modulus: from mod import Mod # Funny math here x = Mod(5, 7) # x ≡ 5 (mod 7) (x + 2) == 0 # True: 5 + 2 ≡ 7 ≡ 0 (mod 7) (x + 7) == x # True: 5 + 7 ≡ 12 ≡ 5 (mod 7) (x**3) == (x + 1) # True: 5³ ≡ 125 ≡ 6 (mod 7) (1 // x) == 3 # True: 5 × 3 ≡ 15 ≡ 1 (mod 7) ⇒ 5⁻¹ ≡ 3 (mod 7)
Starred by 13 users
Forked by 4 users
Languages   Python 100.0% | Python 100.0%
🌐
DataCamp
datacamp.com › tutorial › modulo-operator-python
Modulo Operator in Python: Understanding Key Concepts | DataCamp
March 12, 2025 - The modulo operator (%) in Python calculates the remainder of a division operation. It follows a consistent mathematical formula:
🌐
Analytics Vidhya
analyticsvidhya.com › home › python modulo operator
Python Modulo Operator
April 28, 2025 - The Python Modulo, represented by the symbol %, is a mathematical operator that calculates the remainder of a division operation.
🌐
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.
🌐
Medium
amenoren.medium.com › pythons-modulo-5180441434dc
Python’s Modulo Operator - Annika Noren - Medium
November 16, 2020 - The basic application of the modulo is to represent the remainder after the division of one number — the numerator — by another number — the denominator. 5 % 2 is 1Two goes into five two times with a remainder of 1. Just like regular math, ...
🌐
Codecademy
codecademy.com › docs › python › modulo
Python | Modulo | Codecademy
April 15, 2025 - The modulo operator (%) in Python calculates the remainder of a division operation between two operands. When one number is divided by another, the modulo operation returns what remains after the division is performed.
🌐
PrepBytes
prepbytes.com › home › python › python mod function
Python Mod() Function
August 17, 2023 - The mod function in Python is used to calculate the remainder of a division operation between two numbers. The remainder is the amount left over after the division is performed. For example, the remainder of the division operation 10/3 is 1, ...
🌐
Codingem
codingem.com › home › modulo (%) in python: a complete guide (10+ examples)
Modulo (%) in Python: A Complete Guide (10+ Examples)
November 8, 2022 - In mathematics, the modulo gives you the remainder of the division. In Python, you can calculate the modulo using the percentage operator %.
🌐
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.
🌐
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 - It's important to remember that if you use the modulo operator with a divisor 0, Python will throw a ZeroDivisionError. This same error appears if you use the division operator with zero. >>> 55 % 0 ZeroDivisionError: integer division or modulo by zero · Using the modulo operator with a float value also returns the remainder of division, but the resultant value is a float value. Here's an example: ... Besides using the modulo operator directly with float values, you can use the math.fmod() function to apply the modulo operator on any float value.
🌐
LabEx
labex.io › tutorials › python-how-to-work-with-modular-arithmetic-functions-421961
How to work with modular arithmetic functions | LabEx
This comprehensive tutorial explores modular arithmetic functions in Python, providing developers with essential techniques to manipulate and calculate mathematical operations using modulo principles.