Skip to content
DeepForgeby svx
All problems
EasyData Structuresds-309

Batch Processing Window Count

Problem

Count the batches needed to process records.

record_count records are processed in batches of batch_size; the final batch may be partial. A non-positive batch size processes nothing and returns 0.

Return the number of batches.

Hint

Ceiling division handles the partial final batch.

Test cases

case 1
in: [10,3]
expected: 4
case 2
in: [9,3]
expected: 3
case 3
in: [0,5]
expected: 0
case 4
in: [1,10]
expected: 1
case 5
in: [5,0]
expected: 0
Starter codePython
def batch_count(record_count, batch_size):
    # Your code here
    pass

5 test cases · run your code against them in the editor