This is helpful in situations where you need to do more complex calculations, which may require multiple steps.
Python also has some specific operations which may be defined differently in other languages. One such operation is the floor division
operator (denoted by //
). This operation performs division between two numbers and gives the quotient in which the digits after the decimal point are removed. For example:
xxxxxxxxxx
let a = 5;
let b = 8;
console.log(Math.floor(b / a)); // prints 1
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment