0
What if we just use // this operator and no % for any operation? Would it effect the calculation??
3 Respuestas
+ 2
it would not affect calculation if instead of a%b you used a-b*(a//b), but then you would have three operations instead of just one and it would look terribly ugly
7%2 = 1
7 - 2 * 3 = 1
+ 1
// gives the quotient
eg: 7//3 = 2
% gives the remainder
eg: 7%3 = 1
0
// is floor division. % is modulo. And exactly what prudhvi said is how they work.