<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div><span style="color: rgb(0, 0, 191);">a = [0]*5</span><br style="color: rgb(0, 0, 191);"><span style="color: rgb(0, 0, 191);"> for i in range(0, 4):</span><br style="color: rgb(0, 0, 191);"><span style="color: rgb(0, 0, 191);"> for j in range(0, i):</span><br style="color: rgb(0, 0, 191);"><span style="color: rgb(0, 0, 191);"> a[i].append(j)</span><br><br>why the above codes show the following error. and how to overcome it.<br><br><span style="color: rgb(255, 0, 0);">Traceback (most recent call last):</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> File "<pyshell#10>", line 3, in <module></span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">
a[i].append(j)</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">AttributeError: 'int' object has no attribute 'append'</span><br></div>
</div><br>
</body></html>