+ 2
why 7%(5//2) is 1?
4 Respostas
+ 10
// is operator for floor division
% is operator for modulo
for example: 10 // 3 = 3 and 10 % 3 = 1
because: 10 = 3*3 + 1
5 // 2 = 2
7 % 2 = 1
+ 2
Thank you so much :)
0
how did you done this plz give some details
0
@albert (your nick was not the best choice ;-) )
7 % 2 is modulo-division. This means that the output of this operation is the remainder - here 1.
some more examples:
5 % 3 = 2
14 % 5 = 4
7 % 4 = 3
Also see here for a more detailed explanation:
https://en.Wikipedia.org/wiki/Euclidean_division
Hope this helps.
Regards
Tom