+ 1

% operator

What is the result of this code? >>> 7%(5 // 2) I do not understand how the answer came "1".

19th Apr 2020, 5:07 AM
Cysec
Cysec - avatar
2 ответов
+ 4
The part in the bracket will be calculated first. So 5//2 will do a floor division and give 2. Now apply the modulo operator. 7%(5//2) = 7%(2) = 1
19th Apr 2020, 8:11 AM
Pooja Somani
Pooja Somani - avatar
0
Thank You gays
20th Apr 2020, 2:40 AM
Cysec
Cysec - avatar