Skip to content
Advertisement

How do i fill a list with zeros? When I try to .append(0), I am met with an error message saying that ‘int’ object has no attribute ‘add’

JavaScript
JavaScript

Advertisement

Answer

i is defined twice in your nested loop, the 2nd i will overwrite the first. Rename one of them to avoid this. Also, .add should be .append and range(len(self.z)) should probably be range(self.y) in order to have the correct number of columns.

JavaScript

Side note: why is __init__ returning a value?

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement