What dose two / mean oike i know what this means / but this //? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What dose two / mean oike i know what this means / but this //?

2nd Feb 2019, 7:23 PM
oscar jones
oscar jones - avatar
2 Answers
+ 9
/ is a float division operator and always returns a float number // is a floor division operator and returns an integer (or float if ANY of the numbers is a float) being the next lowest number than the result would be in a float division Carrying on from the previous comment: 5 / 2 = 2.5 5 // 2 = 2 5 / (-2) = -2.5 5 // (-2) = ... -3 (because it is the next lowest of -2.5)
2nd Feb 2019, 7:40 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 8
5/2 = 2.5 (with .5) 5//2 = 2 (without .5)
2nd Feb 2019, 7:25 PM
just trying to think
just trying to think - avatar