z=[]
while len(z)<8:
z=z.append(1)
This programmes says error in the line where the while loop is. The error is mentioned in the title. What should I do ?
z=[]
while len(z)<8:
z=z.append(1)
This programmes says error in the line where the while loop is. The error is mentioned in the title. What should I do ?
You should not use z = z.append(1)
but z.append(1)
as z.append()
returns None.
After the first loop z will not be a list anymore, hence the error.