+ 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
9 Answers
+ 8
And what means 5/=2 (/=)?
+ 8
@Freezemage thanks bro
+ 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.
+ 7
Just division?
+ 3
No its not.
7%(5//2) = 7%2 = 1
+ 3
Also % is a modulus operator, not just a percent symbol. It returns the remainder of division.
+ 2
7%(5//2)= solve like this
7%(5/2)=7%(2)=7%[(2*3)]=6 remains 1 is the answer
+ 1
@Gonzo division and assignment to a variable to shorten the code.
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