0

20//6 should be 3.0 but why the answer is 3 only which is integer.

confusion between integer and float

2nd Feb 2019, 5:35 PM
Ankit kumar
Ankit kumar - avatar
2 odpowiedzi
+ 5
Probably because the result of an integer division between two integers is always an integer. The result of 20//3.5 will be a float.
2nd Feb 2019, 6:25 PM
Anna
Anna - avatar
0
In the example above, 20 % 6 will return 2, because 3*6+2 is equal to 20.
16th Feb 2019, 7:57 PM
MISTGUN
MISTGUN - avatar