TypeError: Objekt 'int' unterstützt keine Elementzuweisung

Warum bekomme ich diesen Fehler?

    a[k] = q % b
 TypeError: 'int' object does not support item assignment

Code:

def algorithmone(n,b,a):
     assert(b > 1)
     q = n
     k = 0
     while q != 0:
        a[k] = q % b
        q = q / b
        ++k

     return k

print (algorithmone(5,233,676))
print (algorithmone(11,233,676))
print (algorithmone(3,1001,94))
print (algorithmone(111,1201,121))

Antworten auf die Frage(1)

Ihre Antwort auf die Frage