- 1

If use double slash for divison will that give a non-decimal number?

Division questions

17th Sep 2019, 3:27 AM
abhishek kongari
abhishek kongari - avatar
4 ответов
+ 4
In A // B, B != 0 Result is whole number only if both A and B are whole numbers. Result is decimal number if either A or B is whole number. Here is a log of all 4 cases: 8//4 = 2 8.0//4 = 2.0 8/4.0 = 2.0 8.0/4.0 = 2.0 5//2 = 2 5.0//2 = 2.0 5//2.0 = 2.0 5.0//2.0 = 2.0
17th Sep 2019, 4:34 AM
Seb TheS
Seb TheS - avatar
+ 2
The floor-division (double slash) operator will *always* give an integral number, never a floating-point (decimal) number That is it's function That is what ~ swim ~ was trying to say. It is easily found in the Python course, no need to downvote him
17th Sep 2019, 3:45 AM
Trigger
Trigger - avatar
+ 1
uh, yeah
17th Sep 2019, 3:41 AM
Choe
Choe - avatar
0
I'm sorry but ur words felt really harsh and ur answer haven't gave any idea that ur answer is relevant to my question I thought u haven't answered my question instead u mad fun of me
17th Sep 2019, 4:04 AM
abhishek kongari
abhishek kongari - avatar