docs

a slatepencil documentail site

View on GitHub

Define a procedure div(m, n), which returns the integer part of m / n, where both arguments are positive integers. Don’t use /. Your function should have type (positiveInt, positiveInt) -> positiveInt

def div(m, n):
    res = m - n
    count = 0
    while res > 0:
        res = res - n
        count += 1
    return count