「/
」是除法,就是普通人類認知的除法,有小數點。如果只要取商數不要餘數,用「//
」:
>>> 8/5 # Fractions aren’t lost when dividing integers
1.6
>>> # Integer division returns the floor: ... 7//3
2
>>> 7//-3
-3
「/
」是浮點數除法、「//
」是整數除法,那「///」是什麼呢?就是 >///< 啦。
「/
」是除法,就是普通人類認知的除法,有小數點。如果只要取商數不要餘數,用「//
」:
>>> 8/5 # Fractions aren’t lost when dividing integers
1.6
>>> # Integer division returns the floor: ... 7//3
2
>>> 7//-3
-3
「/
」是浮點數除法、「//
」是整數除法,那「///」是什麼呢?就是 >///< 啦。