what mean % in python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what mean % in python ?

23rd Apr 2017, 2:06 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
13 Answers
+ 14
That's modulo operator. It returns the remainder from division of two numbers. 3 % 2 = 1; 2 % 2 = 0; 10 % 6 = 4; 5 % 10 = 5;
23rd Apr 2017, 3:16 PM
Wisdom Abioye
Wisdom Abioye - avatar
+ 8
modulus
23rd Apr 2017, 2:09 PM
Nithiwat
Nithiwat - avatar
+ 8
remainder division
23rd Apr 2017, 2:11 PM
Nithiwat
Nithiwat - avatar
+ 4
>>> x = 63%10 >>> print(x) 3 >>> the first number is devided by the second one, what remains is the result. result = first%second
23rd Apr 2017, 2:17 PM
Paul
Paul - avatar
+ 3
means ?
23rd Apr 2017, 2:09 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
+ 3
like 30%5
23rd Apr 2017, 2:10 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
+ 3
OK thx
23rd Apr 2017, 2:11 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
+ 3
:)
23rd Apr 2017, 2:11 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
+ 2
gives you the leftovers after dividing down. 4%2 = 0 10%2 = 0 7%2 = 1 one use is decide if a number is even or odd. if number%2==2 then number is even
23rd Apr 2017, 2:20 PM
LordHill
LordHill - avatar
0
so 10%2= 5 ? or 8..
23rd Apr 2017, 4:03 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
0
si its like minus - ?
23rd Apr 2017, 4:04 PM
Paparawsy Leeplux
Paparawsy Leeplux - avatar
0
10%2=0 .. if divides 10 by 2 until it can't anymore and returns the leftover
23rd Apr 2017, 5:18 PM
LordHill
LordHill - avatar
0
% denote Remainder. you will divide any number from any number then remaining any number its called remainder.👍
25th Jul 2017, 7:26 PM
Ankit Kumar Jain
Ankit Kumar Jain - avatar