+ 2
What does % do in python ?
for an example if (list)%2==0 means?
5 Respostas
+ 16
% Modulus operator divides left hand operand by right hand operand and returns remainder
6%4 = 2
4%4 = 0
-4%6 = -4
-6%4 = -2
-6%-4 = -2
+ 4
Modulus operator returns the reminder after dividing the first number with the second one.
If the first number is smaller than the second, then the quotient will be zero while the remainder will be the first number itself.
If both the numbers are perfectly divisible, remainder will be zero.
+ 4
% means modulus. It gives remainder. (list) % 2==0 means that (list) must be divisible by 2 so that it will leave a remainder 0.
+ 1
thanks for your help
+ 1
เยี่ยมครับ