0

Q about / and // or floor division for python

So / is a forward slash that also asks as a division sign in python Anytime you use / between 2 numbers even if it comes out evenly it will give you a float. What im confused about is if you use // for division that breaks even it wont be a float but // is the floor division even if u use // for just not showing a that its a float is it still floor division? im also confused about floor division and why it rounds down the way it does?/ thanks

4th Oct 2016, 8:22 PM
Louis D
1 Resposta
0
I'm not sure if I understand your question. Is it about how floor division works? If it is, think of it as if it was a function: # imagine a floor function to emulate x // y def floor( x, y ): count = 0 while x >= y: x -= y count += 1.0 return count
19th Nov 2016, 12:18 AM
Vinicius Matté Gregory
Vinicius Matté Gregory - avatar