Python - not subscriptable
<p>I get error TypeError: 'int' object is not subscriptable
what should I do to fix it?</p>

<pre><code>def permutation(k, s):
    r = s[:]
    for j in range(2, len(s)+1):
        r[j-1], r[k%j] = r[k%j], r[j-1]
        k = k/j+1
        return r
</code></pre>
