-2
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 ?

1 Answers1

0

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.

Nasta
  • 819
  • 8
  • 21