220 views
Problem: For the following code I got some errors. The code I wrote is: def algo(n,b,a): assert(b > 1) x = n y = 0 while x != 0: a[y] = x % b x = x / b ++y return y print (algo(1,333,666)) print (algo(11,333,666)) print (algo(111,1001,99)) ... 666)) File "tar.py", line 6, in algo a[y] = x % b TypeError: 'int' object does not support item assignment Why am I getting this error can anyone explain?
asked
Apr 21, 2020
samhaz
5k points