+ 2

how 7%(5//2) is 7?

I understand this code to this way 7% multiply (5//2) 7% multiply (2) So it's 14% or idk something else I don't get it šŸ˜­ Thank you so much guys problem solved by you guys thank you for answering my stupid question

9th Oct 2017, 9:04 PM
ģ •ģ›ģš°
ģ •ģ›ģš° - avatar
9 Answers
+ 8
And what means 5/=2 (/=)?
9th Oct 2017, 9:15 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 8
@Freezemage thanks bro
9th Oct 2017, 9:26 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 7
Percent symbol means modulus, this operator returns the remainder of division. Double slash means division with output in integer data type. In this example firstly calculates part in (), giving you 2.5, but because the output must be integer, it gives 2. Then it does 7%2, so the result of division is 3 and the remainder is 1. Final value is 1.
9th Oct 2017, 9:11 PM
Freezemage
Freezemage - avatar
+ 7
Just division?
9th Oct 2017, 9:19 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 3
No its not. 7%(5//2) = 7%2 = 1
9th Oct 2017, 9:06 PM
Freezemage
Freezemage - avatar
+ 3
Also % is a modulus operator, not just a percent symbol. It returns the remainder of division.
9th Oct 2017, 9:10 PM
deFault
+ 2
7%(5//2)= solve like this 7%(5/2)=7%(2)=7%[(2*3)]=6 remains 1 is the answer
10th Oct 2017, 5:40 PM
CLASH OF CLANE how to get 3 star
CLASH OF CLANE how to get 3 star - avatar
+ 1
@Gonzo division and assignment to a variable to shorten the code.
9th Oct 2017, 9:21 PM
Freezemage
Freezemage - avatar
0
@Gonzo Maybe like this x = 5 x/=2 In this example, the following happens x / 2 = x 5 / 2 = 2.5 x = 2.5
9th Oct 2017, 9:16 PM
Freezemage
Freezemage - avatar