Python Modulo: Using the % Operator
Python supports a wide range ofarithmetic operators that you can use when working withnumbers in your code. One of these operators is themodulo operator (%), which returns the remainder of dividing two numbers. Modular operations are useful to check if a number is even or odd, simplifying cycling through data, and doing non-decimal based units conversion.
In this course, you’ll learn:
- Howmodulo works in mathematics
- How to use the Python modulo operator with differentnumeric types
- How Python calculates the results of amodulo operation
- How to override
.__mod__()in your classes to use them with the modulo operator - How to use the Python modulo operator to solvereal-world problems
The code in this course was tested with Python 3.9.0,% has not change much and older versions should be compatible.
What’s Included:
- 6 Lessons
- Video Subtitles and Full Transcripts
- 2 Downloadable Resources
- Accompanying Text-Based Tutorial
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Downloadable Resources:
Python Modulo: Using the % Operator
6 Lessons 33m
AboutChristopher Trudeau
Christopher has a passion for the Python language and writes, records, and podcasts for Real Python. He is a consultant who helps advise organizations on how to improve their technical teams.
» More about Christopher









