0
What is the function of (//)operator?my statement (true/false)
20//6 =3. Because 6 can only go 3 times in 20 !so // operator checks how many times a number goes into another number
10 odpowiedzi
0
No i need help understanding the operators
0
the answer is simply
yes
👍
0
I thank you
0
I understand now thank you for explaining it to me
0
It's false, because there is an exception when either of the operands were negative:
-20//6=-4
I don't want to explain why it's giving that result.
0
??? Where did you get the -20//6?
0
DeadEye UNT On this Q&A, it has been asked many times why negative floordivisions give weird results.
0
But that's because floor is a concept of converting a decimal number into an integer.
Let's pick a random decimal number: 8.4
If you want to convert it to an integer, you would have to choose between 8 and 9.
floor operator always chooses the smaller integer and that's where the floordivision gets its name.
-20/6 ~ -3.33
-3.33 is located between -4 and -3, thus floor division would choose -4.
0
I see i understand why it does that nnow
0
This is because it always chooses the next smaller number to the result, which, in this case, would be -4...