+ 3
7%(5//2)=1 ??? how ???
5//2 =2 , right???
5 Antworten
+ 8
Yeah. That's absolutely right — 5//2=2
So we get what? 7%(5//2)==7%(2)
Now the "%" symbol signifies the modulo function.
Product=divisor*quotient + remainder.
E.g; 7=2*3 + 1
5=2*2 + 1
What '//' operator does is compute the quotient which is three in the first example when seven is divided by 2. while the '%' operator computes the remainder which is one.
Therefore, 7%2==1
+ 5
Yes that's right
in Python 3.0
"/" is floating point division
"//" is floor division
Example
5/2 = 2.5 (floating point division)
5//2 = 2 (floor division or integer division)
"℅" is modules division or remainder
So 7℅(5//2) = 7℅2 = 1
+ 2
First you have to do what's inside the parenthesis ()
It give us 2
Then you have the modulo 7 % 2.
The modulo give us the remaining number after the devide. So it's 1
+ 1
Ouais. C'est tout à fait vrai 5 // 2 = 2
Alors on a quoi? 7% (5 // 2) == 7% (2)
Maintenant, le symbole "%" signifie la fonction modulo.
Produit = diviseur * quotient + reste.
Par exemple; 7 = 2 * 3 + 1
5 = 2 * 2 + 1
Ce que fait l'opérateur '//', c'est de calculer le quotient qui est "3" dans le premier exemple lorsque sept est divisé par 2. Tandis que l'opérateur '%' calcule le reste, qui est "1".
Par conséquent, 7% 2 == 1
#2sportnews.com
0
wow: 7 = 3 * 2 + 1
so, 7 % 2 = 1