Python Division and the Modulo Operator to get the Remainder - Programming Examples

preview_player
Показать описание
For division use the / operator, which returns a floating-point number.
For floored division use the // operator, which rounds down the result.
Division by 0 is not allowed.

The modulo operator % get the remainder of dividing two integers. Ex: 5%2 is 1.

Modulo is useful for finding out if a number is odd or even, by simply doing number %2 and if it returns 0 it’s even, or 1 then its odd. It’s also useful for determining exact change in a vending machine, for example.

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме
visit shbcf.ru