0
can anyone explain me what is % and //
when iwas learning js ididn't know how 56%3=2 so iskipped it now when I learn python have % and // can any one explain me please or gimme any video link?
3 Answers
+ 1
// stands for Floor Division - The division of operands where the result is the quotient in which the digits after the decimal point are removed. But if one of the operands is negative, the result is floored, i.e., rounded away from zero (towards negative infinity) whereas,
% stands for modular division i.e. it divides left-hand operand by right-hand operand and returns remainder
+ 1
5//2=2 (floor division)
whereas,
5%2=1 ( modular division which gives remainder)
0
can u gimme a example