+ 1
I'm having trouble in 7%(5//2)? Plz tell me with good explanation
3 Respuestas
+ 8
Parantheses have highest precedence. So, 5//2 is executed first.
5//2 = quotient when 5 is divided by 2 = 2
So, 7%(5//2) = 7%2.
7%2 = remainder when 7 is divided by 2 = 1
So, 7%(5//2) = 1.
0
1) 7%(5//2)
-> in order the parentheses performs first.
The "//" symbol realize a division. The result is an integer number.
-> 5//2 = 2
2) 7%(2)
-> The "%" calculate the remainder of a division
->7÷2 = 3.5 and the remainder is 1.
-> 7%2 = 1
So, 7%(5//2) = 1
0
You first execute the operation in parenthesis, where the double forward slash means dividing, 5//2 gives you 2 remainder 1, so you answer will be 2. You will then have 7%2 after solving the parenthesis.
The % signs means modulo, where the answer becomes 3 remainder 1, thus the modulo is the remainder which is 1.