Python’s Modulo Operator

Photo by Karim MANJRA on Unsplash
5 % 2 is 1Two goes into five two times with a remainder of 1.
Error if using 0
Using modulo with floats
Using the Math library
Denominator determines the sign of the result
True for fmod()
Use divmod() to find quotient and remainder
Determine even or odd number
Use of modulo




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Bracket Matching Python Code Challenge

Calm water ripple

Ruby Design Pattern: Composite Method

Azure vs. AWS vs. Google Cloud

So, you want to learn programming but you’re unsure what programming language to learn, This is a…

shapely White CZ Gold Plated White Ring wholesales US 6789

Secure your ElasticSearch database in 2 minutes

Compilation step by step in C with GCC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Annika Noren

Annika Noren

More from Medium

Python string replacement | string. replace() method

Python Basics, Variables & Data Types

Unit Testing in Python

Functions Variables Scope In Python