Reconnaissance and Enumeration
A Python script has total = 1000 ports and size = 300 ports per batch. It must find how many ports are in the final, partial batch. Which expression gives that?
Show the answer
Correct answerB. total % size
AWhy not this: // returns the whole number of full batches, which is 3, not the leftover ports.
BWhy this is right: % returns the remainder of the division, which is 100 ports left over after three full batches.
CWhy not this: / returns the float 3.33, which does not give a count of leftover ports.
DWhy not this: Subtraction gives 700, the ports remaining after one batch, not the final partial batch.
The modulo operator returns the remainder of a division, here 100, which is the size of the last partial batch. Floor division returns 3, the number of full batches, not the leftover ports.