13.2k views
0 votes
How do i find the remainder of a number using python?

User Oldman
by
5.3k points

1 Answer

2 votes
To find the remainder of a division, use the modulo operator. In python this is the '%' operator. For example:

6 divided by 3 = 2 with zero remainder (ie 6=(2*3)+0)
6%3=0

7 divided by 3 = 2 with one reminder (ie 7=(6*2)+1)
7%3=1
User DumbPy
by
6.2k points