+ 1
What is % mean
If len(list)%2==0
5 Respuestas
+ 10
That's a modules operator. It returns the remainder of 2 values.
E.g. 56%3 = 2
+ 3
% is a modulus operator ,it gives the remainder .
e.g 3%2=1
5%3=2...
+ 2
% means modulus operator
It gives the value of remainder when two values are divided
For example: 14%3=2
3%2=1
2%2=0
+ 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1
6 % 2 = 0
7 % 2 = 1
x%2 ==0 will tell you if a number is odd
0
if len(list)%2 == 0:
if the length of the list is even.