0

I am new to programming.When I find this strange result while I learning python.

>>> 10/-7
-2
Cory Kramer
  • 114,268
  • 16
  • 167
  • 218
  • That's not strange, that's normal. ;) In Python 2, `10/-7` does floor division, but it's better to write it as `10//-7`, which explicitly says that you're doing floor division. Floor division always rounds down, i.e., towards negative infinity. – PM 2Ring Sep 29 '17 at 17:46
  • 1
    If you are learning Python, you should be learning Python 3, not Python 2, which has an official EOL date of 2020. – juanpa.arrivillaga Sep 29 '17 at 17:54

0 Answers0