+ 1
What does 12//3 mean?
4 odpowiedzi
+ 1
// is used for integer division .
outputs 12//3 =4
where as 12 /3=4.0
+ 1
Ah division , but they use // instead of / like other languages. Thanks for your answer.
+ 1
The // operator is known as a floor divider. What it does is it divides the 2 operands provided in the equation, leaving out the remainder, or alternatively, it sees how many times the second operand can be added to itself before going over the first operand. So as it does have some aspects of division, // is not the same as /.
For example, take the equation 15//4. If the two operands were to be divided, then 3.8 would have been returned. Because this is floor division though, it rounds that down to a whole number, returning 3.
+ 1
Really appreciate for your detailed explanation . :) Faisal.