+ 1

How?

I dont understand %7(5//2)

14th Jan 2018, 10:17 PM
JJ_AstroTech
6 ответов
+ 7
Do you mean 7%(5//2) ?? You should be more specific with your question, so that people can better help you.
14th Jan 2018, 10:29 PM
Fox
Fox - avatar
+ 3
Assuming you meant 7%(5//2), the code will run the equation using order of operations, meaning anything in the brackets will run first. 5//2 will find the number of times 2 can go into 5 without going over it or going into decimal places. This means that the outcome of that will be 2 (2*2=4, multiplying 2 by 2 becuase it is the largest number 2 can be multiplied by before going over 5 (2*3=6)). So now, we are left with 7%2. The modulo (%) operator will take the remainder of the division of the 2 operands while again still not going into decimals (7÷2=3 with a remainder of 1). So the result will be 1.
14th Jan 2018, 10:34 PM
Faisal
Faisal - avatar
+ 3
good answer, @Faisal
14th Jan 2018, 11:25 PM
serhio923
serhio923 - avatar
0
I don’t understand 7%(5//2)
14th Jan 2018, 10:29 PM
JJ_AstroTech
0
7%(5//2) is the same get the integer quocient of 5÷2, it is: 2 because 2x(2)+1 = 5 Now tell what is the rest of the division: 2÷2; it is: 2×(3)+1 .. look ! here the quocient can be ignored. The division // just orint the rest of a division. So: 7//(5% 2) == 7//(2) == 1
15th Jan 2018, 12:02 AM
▲TopGun ▲
▲TopGun ▲ - avatar
0
try make check many operations with // and % to identify what is happening.
15th Jan 2018, 12:03 AM
▲TopGun ▲
▲TopGun ▲ - avatar