+ 1
What's the difference between floor division (//) and division (/)?
3 Respostas
+ 13
/
type: standart division
Returns: float
exaple: 5 / 2 = 2.5
//
type: floor division
Returns: int if left and right side are integers, otherwise - float
example: 5 // 2 = 2
+ 2
Considering '5' & '2' like an integer, the division's result will be an (integer).
Example:
5 / 2 = 2 (int)
5 / 2. = 2.5 (float)
5 // 2 = 2 (int)
5 // 2. = 2.0 (float)
+ 1
Let me simplify what they are saying, floor division takes the remainder of a number and turns it into a float, for example 20/6 = 3.3333333333333335 while floor division "simplifies it" 20//6 = 3