Python - remainder operator : <p>Although I know there is a built in <code>str()</code> <code>function</code> in <code>python</code>, I'm trying to understand its logic.</p>

<pre><code>def intToStr(i):
    digits = '0123456789'
    if i == 0:
        return '0'
    result = ''
    while i &gt; 0:
        result = digits[i%10] + result
        i = i/10
    return result
</code></pre>

<p>what I don't get is the part in the <code>loop</code> where <code>[i%10]</code>. </p>

<p>How do I get a remainder when <code>i</code> <code>&lt;</code> <code>10</code>?</p>
