Why Python says sixteen.
transcript
Six plus four times three minus eight over five. A calculator says seventeen. Your Python code says sixteen. One division is to blame. Both read the same text. Let us find it.
The stack holds the terms. Six, and twelve. Minus eight is a new term. Now divide it by five. The exact value is minus one point six. Drop the fraction toward zero. Six plus twelve minus one is seventeen.
Python slash slash rounds down. Minus one point six becomes minus two. The total becomes sixteen. That is wrong.
Java and C plus plus truncate on their own. JavaScript needs Math dot trunc. Python needs a fix. Check your own language before you trust it.
Divide the size of the number. Eight divided by five is one. Then put the sign back. Minus one. Correct.
Truncate toward zero. Dividing a negative term is the trap. Test with a negative term. Full breakdown in the lecture.