The integer division there is just taking the floor of the number obtained at the end.
10/3 -> floor(3.33) -> 3
-10/3 -> floor(-3.33) -> -4
(Why it floors)
The modulo operation on the other hand is following the mathematical definition.
Related Contents:
- The modulo operation on negative numbers in Python
- Find the division remainder of a number
- How does the modulo (%) operator work on negative numbers in Python?
- What is the result of % in Python?
- How do you check whether a number is divisible by another number?
- Negative integer division surprising result
- What does the percentage sign mean in Python
- Python modulo on floats
- C and Python – different behaviour of the modulo (%) operation
- TypeError: unsupported operand type(s) for /: ‘str’ and ‘str’
- How to replace negative numbers in Pandas Data Frame by zero
- Modulo operator in Python
- Floor division with negative number
- Syntax error on print with Python 3 [duplicate]
- Why do Python classes inherit object?
- How do I check if a list is empty?
- lambda in for loop only takes last value [duplicate]
- How do I initialize a dictionary of empty lists in Python?
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- Get HTML source of WebElement in Selenium WebDriver using Python
- Is Python strongly typed?
- pandas: filter rows of DataFrame with operator chaining
- How to execute Python scripts in Windows?
- Plotting with seaborn using the matplotlib object-oriented interface
- C-like structures in Python
- How do you create nested dict in Python?
- Difference between except: and except Exception as e:
- Scheduling Python Script to run every hour accurately
- Numpy – create matrix with rows of vector
- The smtplib.server.sendmail function in python raises UnicodeEncodeError: ‘ascii’ codec can’t encode character
- How does the key argument in python’s sorted function work?
- Classification using movie review corpus in NLTK/Python
- How can I strip the whitespace from Pandas DataFrame headers?
- Storing RTSP stream as video file with OpenCV VideoWriter
- Generate RFC 3339 timestamp in Python [duplicate]
- How do I pass extra arguments to a Python decorator?
- Python Multiprocessing: Handling Child Errors in Parent
- Check if string has date, any format
- Writing to a file in a for loop only writes the last value
- How can I limit the user input to only integers in Python
- How to get response SSL certificate from requests in python?
- Pandas rolling apply using multiple columns
- How can I create directories recursively? [duplicate]
- Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]
- Map each list value to its corresponding percentile
- What is the best solution for database connection pooling in python?
- How to delete every reference of an object in Python?
- regexes: How to access multiple matches of a group? [duplicate]
- Python ? (conditional/ternary) operator for assignments [duplicate]
- How do I find the maximum (larger, greater) of 2 numbers?